Mercurial > hg > dmlib
changeset 1655:a05e3fcc60ec
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 30 May 2018 13:20:40 +0300 |
parents | 92656ad7f706 |
children | 2de258f2eb2e |
files | tools/libgfx.c |
diffstat | 1 files changed, 11 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/libgfx.c Wed May 30 12:41:31 2018 +0300 +++ b/tools/libgfx.c Wed May 30 13:20:40 2018 +0300 @@ -158,14 +158,14 @@ // Set alpha values to max, except for transparent color for (int i = 0; i < ncolors; i++) { - (*ppal)[i].a = (i == ctransp) ? 0 : 255; + (*ppal)[i].a = (i == ctransp) ? 0x00 : 0xff; } return TRUE; } -BOOL dmImageAllocPalette(DMImage *img, int ncolors, int ctransp) +BOOL dmImagePaletteAlloc(DMImage *img, int ncolors, int ctransp) { if (img == NULL) return FALSE; @@ -176,7 +176,7 @@ } -static BOOL dmReadPaletteData(DMResource *fp, DMColor *pal, int ncolors) +static BOOL dmPaletteReadData(DMResource *fp, DMColor *pal, int ncolors) { for (int i = 0; i < ncolors; i++) { @@ -711,7 +711,7 @@ ncolors = 256; dmMsg(2, "PNG: Generating %d color grayscale palette.\n", ncolors); - if (!dmImageAllocPalette(img, ncolors, -1)) + if (!dmImagePaletteAlloc(img, ncolors, -1)) { res = DMERR_MALLOC; goto error; @@ -728,7 +728,7 @@ dmMsg(2, "PNG: Palette of %d colors found.\n", ncolors); if (ncolors > 0 && palette != NULL) { - if (!dmImageAllocPalette(img, ncolors, -1)) + if (!dmImagePaletteAlloc(img, ncolors, -1)) { res = DMERR_MALLOC; goto error; @@ -1364,7 +1364,7 @@ ncolors = 256; } - if (!dmImageAllocPalette(img, ncolors, -1)) + if (!dmImagePaletteAlloc(img, ncolors, -1)) { res = dmError(DMERR_MALLOC, "PCX: Could not allocate palette data!\n"); @@ -1375,7 +1375,7 @@ { // Okay, attempt to read the palette data dmMsg(2, "PCX: Reading palette of %d colors\n", ncolors); - if (!dmReadPaletteData(fp, img->pal, ncolors)) + if (!dmPaletteReadData(fp, img->pal, ncolors)) { res = dmError(DMERR_FREAD, "PCX: Error reading palette.\n"); @@ -1786,9 +1786,10 @@ "ILBM: Error reading BMHD chunk.\n"); } - dmMsg(2, "ILBM: BMHD %d x %d @ %d, %d : nplanes=%d, comp=%d, mask=%d\n", + dmMsg(2, "ILBM: BMHD %d x %d @ %d, %d : nplanes=%d, comp=%d, mask=%d, transp=%d\n", iff.bmhd.w, iff.bmhd.h, iff.bmhd.x, iff.bmhd.y, - iff.bmhd.nplanes, iff.bmhd.compression, iff.bmhd.masking); + iff.bmhd.nplanes, iff.bmhd.compression, iff.bmhd.masking, + iff.bmhd.transp); // Sanity check if (iff.bmhd.nplanes < 1 || iff.bmhd.nplanes > 8 || @@ -1836,7 +1837,7 @@ return dmError(DMERR_MALLOC, "ILBM: Could not allocate palette data.\n"); } - if (!dmReadPaletteData(fp, iff.pal, iff.ncolors)) + if (!dmPaletteReadData(fp, iff.pal, iff.ncolors)) { return dmError(DMERR_FREAD, "ILBM: Error reading CMAP.\n");