Mercurial > hg > dmlib
diff tools/libgfx.c @ 1801:0562dd55a1f6
s/DM_IFMT_/DM_COLFMT_/g
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 14 Jun 2018 12:58:44 +0300 |
parents | 45e7688336dc |
children | 4b08e6a26564 |
line wrap: on
line diff
--- a/tools/libgfx.c Thu Jun 14 12:42:29 2018 +0300 +++ b/tools/libgfx.c Thu Jun 14 12:58:44 2018 +0300 @@ -99,10 +99,10 @@ { switch (format) { - case DM_IFMT_PALETTE : return 1; - case DM_IFMT_RGB : return 3; - case DM_IFMT_RGBA : return 4; - default: return -1; + case DM_COLFMT_PALETTE : return 1; + case DM_COLFMT_RGB : return 3; + case DM_COLFMT_RGBA : return 4; + default : return -1; } } @@ -227,12 +227,12 @@ switch (spec->format) { - case DM_IFMT_PALETTE: + case DM_COLFMT_PALETTE: for (xscale = 0; xscale < spec->scaleX; xscale++) *ptr1++ = c; break; - case DM_IFMT_RGBA: + case DM_COLFMT_RGBA: qr = img->pal[c].r; qg = img->pal[c].g; qb = img->pal[c].b; @@ -260,7 +260,7 @@ } break; - case DM_IFMT_RGB: + case DM_COLFMT_RGB: qr = img->pal[c].r; qg = img->pal[c].g; qb = img->pal[c].b; @@ -388,7 +388,7 @@ // Write image data memcpy(&tmpSpec, spec, sizeof(DMImageConvSpec)); - tmpSpec.format = DM_IFMT_RGB; + tmpSpec.format = DM_COLFMT_RGB; return dmWriteImageData(img, (void *) fp, dmWritePPMRow, &tmpSpec); } @@ -500,9 +500,9 @@ // Write PNG header info switch (spec->format) { - case DM_IFMT_PALETTE: fmt = PNG_COLOR_TYPE_PALETTE; break; - case DM_IFMT_RGB : fmt = PNG_COLOR_TYPE_RGB; break; - case DM_IFMT_RGBA : fmt = PNG_COLOR_TYPE_RGB_ALPHA; break; + case DM_COLFMT_PALETTE: fmt = PNG_COLOR_TYPE_PALETTE; break; + case DM_COLFMT_RGB : fmt = PNG_COLOR_TYPE_RGB; break; + case DM_COLFMT_RGBA : fmt = PNG_COLOR_TYPE_RGB_ALPHA; break; default: res = dmError(DMERR_NOT_SUPPORTED, "PNG: Unsupported image format %d.\n", @@ -525,7 +525,7 @@ 8, fmt); // Palette - if (spec->format == DM_IFMT_PALETTE) + if (spec->format == DM_COLFMT_PALETTE) { int i; png_colorp palette = png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH * sizeof(png_color)); @@ -681,7 +681,7 @@ width, height, bit_depth, color_type); if ((*pimg = img = dmImageAlloc(width, height, - DM_IFMT_PALETTE, + DM_COLFMT_PALETTE, // XXX TODO? When/if we ever handle < 8bit indexed correctly, we can use the actual bpp -1 /* bit_depth */)) == NULL) { @@ -1262,7 +1262,7 @@ // Allocate image if ((*pimg = img = dmImageAlloc(hdr.xmax - hdr.xmin + 1, hdr.ymax - hdr.ymin + 1, - isPaletted ? DM_IFMT_PALETTE : DM_IFMT_RGBA, + isPaletted ? DM_COLFMT_PALETTE : DM_COLFMT_RGBA, // XXX TODO? When/if we ever handle < 8bit indexed correctly, we can use the actual bpp // isPaletted ? (hdr.bitsPerPlane * hdr.nplanes) : -1 -1 @@ -1880,7 +1880,7 @@ // Allocate image if ((*pimg = dmImageAlloc(iff.bmhd.w, iff.bmhd.h, - iff.bmhd.nplanes <= 8 ? DM_IFMT_PALETTE : DM_IFMT_RGBA, + iff.bmhd.nplanes <= 8 ? DM_COLFMT_PALETTE : DM_COLFMT_RGBA, // XXX TODO? When/if we ever handle < 8bit indexed correctly, we can use the actual bpp //iff->bmhd.nplanes <= 8 ? iff->bmhd.nplanes : -1 -1