# HG changeset patch # User Matti Hamalainen # Date 1528970324 -10800 # Node ID 0562dd55a1f60374077bd477957b9588fdd35f74 # Parent 45e7688336dcebbff3aa12ba5090cd6aa4d56c75 s/DM_IFMT_/DM_COLFMT_/g diff -r 45e7688336dc -r 0562dd55a1f6 tools/gfxconv.c --- a/tools/gfxconv.c Thu Jun 14 12:42:29 2018 +0300 +++ b/tools/gfxconv.c Thu Jun 14 12:58:44 2018 +0300 @@ -1088,10 +1088,10 @@ char *str; switch (format) { - case DM_IFMT_PALETTE : str = "Indexed 8bpp"; break; - case DM_IFMT_RGB : str = "24bit RGB"; break; - case DM_IFMT_RGBA : str = "32bit RGBA"; break; - default : str = "???"; break; + case DM_COLFMT_PALETTE : str = "Indexed 8bpp"; break; + case DM_COLFMT_RGB : str = "24bit RGB"; break; + case DM_COLFMT_RGBA : str = "32bit RGBA"; break; + default : str = "???"; break; } dmMsg(2, "%s output.\n", str); } @@ -1153,20 +1153,20 @@ { #ifdef DM_USE_LIBPNG case DM_IMGFMT_PNG: - spec->format = spec->paletted ? DM_IFMT_PALETTE : DM_IFMT_RGBA; + spec->format = spec->paletted ? DM_COLFMT_PALETTE : DM_COLFMT_RGBA; dmOutputImageBitFormat(spec->format, info); res = dmWritePNGImage(filename, image, spec); break; #endif case DM_IMGFMT_PPM: - spec->format = DM_IFMT_RGB; + spec->format = DM_COLFMT_RGB; dmOutputImageBitFormat(spec->format, info); res = dmWritePPMImage(filename, image, spec); break; case DM_IMGFMT_PCX: - spec->format = spec->paletted ? DM_IFMT_PALETTE : DM_IFMT_RGB; + spec->format = spec->paletted ? DM_COLFMT_PALETTE : DM_COLFMT_RGB; dmOutputImageBitFormat(spec->format, info); res = dmWritePCXImage(filename, image, spec); break; @@ -1509,7 +1509,7 @@ goto error; } - outImage = dmImageAlloc(outWidthPX, outHeight, DM_IFMT_PALETTE, -1); + outImage = dmImageAlloc(outWidthPX, outHeight, DM_COLFMT_PALETTE, -1); dmMsg(1, "Outputting sequence of %d images @ %d x %d -> %d x %d.\n", optItemCount, outImage->width, outImage->height, @@ -1529,7 +1529,7 @@ if (optItemCount % optPlanedWidth) outIHeight++; - outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_IFMT_PALETTE, -1); + outImage = dmImageAlloc(outWidthPX * outIWidth, outIHeight * outHeight, DM_COLFMT_PALETTE, -1); } dmSetDefaultC64Palette(outImage); diff -r 45e7688336dc -r 0562dd55a1f6 tools/lib64gfx.c --- a/tools/lib64gfx.c Thu Jun 14 12:42:29 2018 +0300 +++ b/tools/lib64gfx.c Thu Jun 14 12:58:44 2018 +0300 @@ -1312,7 +1312,7 @@ return DMERR_NULLPTR; // Allocate image structure - if ((*pdst = dst = dmImageAlloc(src->width, src->height, DM_IFMT_PALETTE, -1)) == NULL) + if ((*pdst = dst = dmImageAlloc(src->width, src->height, DM_COLFMT_PALETTE, -1)) == NULL) return DMERR_MALLOC; // Set partial palette information diff -r 45e7688336dc -r 0562dd55a1f6 tools/libgfx.c --- 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 diff -r 45e7688336dc -r 0562dd55a1f6 tools/libgfx.h --- a/tools/libgfx.h Thu Jun 14 12:42:29 2018 +0300 +++ b/tools/libgfx.h Thu Jun 14 12:58:44 2018 +0300 @@ -30,9 +30,9 @@ enum { - DM_IFMT_PALETTE, - DM_IFMT_RGB, - DM_IFMT_RGBA, + DM_COLFMT_PALETTE, + DM_COLFMT_RGB, + DM_COLFMT_RGBA, }; @@ -69,7 +69,7 @@ // Bitmapped image struct typedef struct { - int format; // one of types specified by DM_IFMT_* + int format; // one of types specified by DM_COLFMT_* int width, height; int pitch; // bytes per scanline int bpp; // bits per pixel