MCPcopy Create free account
hub / github.com/NetHack/NetHack / MyAllocBitMap

Function MyAllocBitMap

sys/amiga/winchar.c:286–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284};
285
286struct BitMap *
287MyAllocBitMap(int xsize, int ysize, int depth, long mflags)
288{
289 int j;
290 struct MyBitMap *bm;
291
292 bm = (struct MyBitMap *) alloc(sizeof(*bm));
293 if (!bm)
294 return (NULL);
295
296 bm->xsize = xsize;
297 bm->ysize = ysize;
298 InitBitMap(&bm->bm, depth, xsize, ysize);
299 for (j = 0; j < depth; ++j) {
300 if (mflags & MEMF_CHIP)
301 bm->bm.Planes[j] = AllocRaster(xsize, ysize);
302 else
303 bm->bm.Planes[j] = AllocMem(RASSIZE(xsize, ysize), mflags);
304
305 if (bm->bm.Planes[j] == 0) {
306 MyFreeBitMap(&bm->bm);
307 return (NULL);
308 }
309 if (mflags & MEMF_CLEAR)
310 memset(bm->bm.Planes[j], 0, RASSIZE(xsize, ysize));
311 }
312 return (&bm->bm);
313}
314
315void
316MyFreeBitMap(struct BitMap *bmp)

Callers 3

ReadImageFileFunction · 0.85
ReadTileImageFilesFunction · 0.85
winchar.cFile · 0.85

Calls 2

MyFreeBitMapFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected