Mercurial > hg > dmlib
diff lib64gfx.c @ 435:e4a3f183e463
Modularize some more.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 03 Nov 2012 16:08:30 +0200 |
parents | ba6ec5ee5929 |
children | afa7f8dd4a8f |
line wrap: on
line diff
--- a/lib64gfx.c Sat Nov 03 14:52:52 2012 +0200 +++ b/lib64gfx.c Sat Nov 03 16:08:30 2012 +0200 @@ -7,7 +7,7 @@ * Please read file 'COPYING' for information on license and distribution. */ #include "lib64gfx.h" -#include <errno.h> + const char *dmC64ImageTypeNames[DM_C64IFMT_LAST_TYPE] = { @@ -53,55 +53,6 @@ -DMImage * dmImageAlloc(int width, int height) -{ - DMImage *img = dmCalloc(1, sizeof(DMImage)); - if (img == NULL) - return NULL; - - img->width = img->pitch = width; - img->height = height; - img->data = dmMalloc(width * height * sizeof(Uint8)); - if (img->data == NULL) - { - dmFree(img); - return NULL; - } - - return img; -} - - -void dmImageFree(DMImage *img) -{ - if (img != NULL) - { - if (!img->constpal) - { - dmFree(img->pal); - } - dmFree(img->data); - dmFree(img); - } -} - - -int dmImageGetBytesPerPixel(int format) -{ - switch (format) - { - case DM_IFMT_PALETTE : return 1; - - case DM_IFMT_RGB_PLANE : - case DM_IFMT_RGB : return 3; - - case DM_IFMT_RGBA : return 4; - - default: return 0; - } -} - - int dmC64ConvertCSData(DMImage *img, int xoffs, int yoffs, const Uint8 *buf, int width, int height, BOOL multicolor, int *colors)