# HG changeset patch # User Matti Hamalainen # Date 1559654321 -10800 # Node ID e6ec7fad9ce2a7ebeb4eee3cb000686bd87806a8 # Parent 28b7a842181f1300237beb04329a204a298e1f10 Rename DMImageConvSpec to DMImageWriteSpec to better reflec the struct's purpose. diff -r 28b7a842181f -r e6ec7fad9ce2 tools/gfxconv.c --- a/tools/gfxconv.c Tue Jun 04 16:15:58 2019 +0300 +++ b/tools/gfxconv.c Tue Jun 04 16:18:41 2019 +0300 @@ -137,7 +137,7 @@ char *optCharROMFilename = NULL; -DMImageConvSpec optSpec = +DMImageWriteSpec optSpec = { .scaleX = 1, .scaleY = 1, @@ -1392,7 +1392,7 @@ int dmWriteIFFMasterRAWHeaderFile( const char *hdrFilename, const char *dataFilename, const char *prefix, const DMImage *img, - const DMImageConvSpec *spec) + const DMImageWriteSpec *spec) { DMResource *fp; int res; @@ -1411,7 +1411,7 @@ } -int dmWriteImage(const char *filename, DMImage *pimage, DMImageConvSpec *spec, const DMImageFormat *fmt, BOOL info) +int dmWriteImage(const char *filename, DMImage *pimage, DMImageWriteSpec *spec, const DMImageFormat *fmt, BOOL info) { int res = DMERR_OK; diff -r 28b7a842181f -r e6ec7fad9ce2 tools/libgfx.c --- a/tools/libgfx.c Tue Jun 04 16:15:58 2019 +0300 +++ b/tools/libgfx.c Tue Jun 04 16:18:41 2019 +0300 @@ -330,7 +330,7 @@ int dmWriteImageData(const DMImage *img, void *cbdata, int (*writeRowCB)(void *, const Uint8 *, const size_t), - const DMImageConvSpec *spec) + const DMImageWriteSpec *spec) { int x, y, yscale, xscale, res = 0, rowSize, rowWidth; Uint8 *row = NULL; @@ -574,7 +574,7 @@ int dmWriteIFFMasterRAWHeader( DMResource *fp, const char *filename, const char *prefix, - const DMImage *img, const DMImageConvSpec *spec) + const DMImage *img, const DMImageWriteSpec *spec) { if (dmfprintf(fp, "%s_width: dw.w %d\n" @@ -625,7 +625,7 @@ static int dmWriteRAWRow(DMBitStreamContext *bs, const DMImage *img, - const DMImageConvSpec *spec, const int yc, const int plane) + const DMImageWriteSpec *spec, const int yc, const int plane) { const Uint8 *sp = img->data + (yc * img->pitch); for (int xc = 0; xc < img->width; xc++) @@ -650,7 +650,7 @@ } -int dmWriteRAWImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) +int dmWriteRAWImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec) { int res; DMBitStreamContext ctx; @@ -698,7 +698,7 @@ } -int dmWriteCDumpImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) +int dmWriteCDumpImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec) { int res; DMBitStreamContext ctx; @@ -765,9 +765,9 @@ } -int dmWritePPMImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) +int dmWritePPMImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec) { - DMImageConvSpec tmpSpec; + DMImageWriteSpec tmpSpec; char *tmpFmt; // Check if we can do this @@ -778,7 +778,7 @@ "Conversion of non-indexed image to indexed not supported yet.\n"); } - memcpy(&tmpSpec, spec, sizeof(DMImageConvSpec)); + memcpy(&tmpSpec, spec, sizeof(DMImageWriteSpec)); switch (spec->format) { @@ -974,7 +974,7 @@ } -int dmWritePNGImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) +int dmWritePNGImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec) { png_structp png_ptr = NULL; png_infop info_ptr = NULL; @@ -1415,15 +1415,15 @@ } -int dmWritePCXImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *pspec) +int dmWritePCXImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *pspec) { DMPCXData pcx; DMPCXHeader hdr; - DMImageConvSpec spec; + DMImageWriteSpec spec; int res; // Always force planar for PCX - memcpy(&spec, pspec, sizeof(DMImageConvSpec)); + memcpy(&spec, pspec, sizeof(DMImageWriteSpec)); spec.planar = TRUE; // XXX: 24bit PCX does not work yet .. @@ -2630,7 +2630,7 @@ } -int dmWriteIFFImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec) +int dmWriteIFFImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec) { DMIFF iff; Uint8 *buf = NULL; diff -r 28b7a842181f -r e6ec7fad9ce2 tools/libgfx.h --- a/tools/libgfx.h Tue Jun 04 16:15:58 2019 +0300 +++ b/tools/libgfx.h Tue Jun 04 16:18:41 2019 +0300 @@ -108,7 +108,7 @@ int nplanes, bpp, mask; // number of planes, bits per PLANE, masking BOOL planar; // use planar format if the format supports it int compression; // Use compression/compression level (0 = none, 9 = max) -} DMImageConvSpec; +} DMImageWriteSpec; typedef struct @@ -119,7 +119,7 @@ int flags; // DM_FMT_* and DM_COLFMT_* flags int (*probe)(const Uint8 *buf, const size_t len); int (*read)(DMResource *fp, DMImage **pimg); - int (*write)(DMResource *fp, const DMImage *pimg, const DMImageConvSpec *spec); + int (*write)(DMResource *fp, const DMImage *pimg, const DMImageWriteSpec *spec); } DMImageFormat; @@ -143,25 +143,25 @@ int dmWriteImageData(const DMImage *img, void *cbdata, - int (*writeRowCB)(void *, const Uint8 *, const size_t), const DMImageConvSpec *spec); + int (*writeRowCB)(void *, const Uint8 *, const size_t), const DMImageWriteSpec *spec); -int dmWriteIFFMasterRAWHeader(DMResource *fp, const char *filename, const char *prefix, const DMImage *img, const DMImageConvSpec *spec); -int dmWriteRAWImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec); +int dmWriteIFFMasterRAWHeader(DMResource *fp, const char *filename, const char *prefix, const DMImage *img, const DMImageWriteSpec *spec); +int dmWriteRAWImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec); -int dmWritePPMImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec); +int dmWritePPMImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec); int dmReadPPMImage(DMResource *fp, DMImage **pimg); #ifdef DM_USE_LIBPNG -int dmWritePNGImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec); +int dmWritePNGImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec); int dmReadPNGImage(DMResource *fp, DMImage **pimg); #endif -int dmWritePCXImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec); +int dmWritePCXImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec); int dmReadPCXImage(DMResource *fp, DMImage **pimg); int dmReadIFFImage(DMResource *fp, DMImage **pimg); -int dmWriteIFFImage(DMResource *fp, const DMImage *img, const DMImageConvSpec *spec); +int dmWriteIFFImage(DMResource *fp, const DMImage *img, const DMImageWriteSpec *spec); typedef struct _DMBitStreamContext