Mercurial > hg > dmlib
diff tools/lib64gfx.c @ 2109:510ea816d1ff
Add helper function dmC64MemBlockAllocSubj().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 24 May 2019 02:29:27 +0300 |
parents | 5f8f170f8774 |
children | 3fcf1c3a3287 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Fri May 24 02:27:45 2019 +0300 +++ b/tools/lib64gfx.c Fri May 24 02:29:27 2019 +0300 @@ -1465,6 +1465,24 @@ } +int dmC64MemBlockAllocSubj(DMC64Image *img, const int subject, const int bank) +{ + const char *subjname = dmC64GetOpSubjectName(subject); + size_t size = dmC64GetSubjectSize(subject, img->fmt); + DMC64MemBlock *blk = (DMC64MemBlock *) dmC64GetOpMemBlock(img, subject, bank); + int res; + + if ((res = dmC64MemBlockAlloc(blk, size)) != DMERR_OK) + { + return dmError(res, + "Could not allocate '%s' block with size %d bytes.\n", + subjname, size); + } + + return DMERR_OK; +} + + // Convert a generic bitmap image to DMC64Image int dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)