changeset 2223:5477e792def3

Remove useless DMC64ImageFormat parameter from some conversion functions.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 12:12:19 +0300
parents 75b5bb490f38
children a36c81c3df85
files tools/64vw.c tools/gfxconv.c tools/lib64gfx.c tools/lib64gfx.h
diffstat 4 files changed, 16 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/tools/64vw.c	Fri Jun 14 12:08:59 2019 +0300
+++ b/tools/64vw.c	Fri Jun 14 12:12:19 2019 +0300
@@ -225,8 +225,7 @@
 }
 
 
-int dmDecodeC64Image(DMC64Image *cimage, const DMC64ImageFormat *fmt,
-    SDL_Surface *surf, const DMC64ImageConvSpec *spec)
+int dmDecodeC64Image(DMC64Image *cimage, SDL_Surface *surf, const DMC64ImageConvSpec *spec)
 {
     DMImage bmap;
     BOOL charDataSet;
@@ -253,10 +252,10 @@
     else
         charDataSet = FALSE;
 
-    if (fmt->format->convertFrom != NULL)
-        res = fmt->format->convertFrom(&bmap, cimage, fmt, spec);
+    if (cimage->fmt->convertFrom != NULL)
+        res = cimage->fmt->convertFrom(&bmap, cimage, spec);
     else
-        res = dmC64ConvertGenericBMP2Image(&bmap, cimage, fmt, spec);
+        res = dmC64ConvertGenericBMP2Image(&bmap, cimage, spec);
 
     if (charDataSet)
         memset(&cimage->charData[0], 0, sizeof(DMC64MemBlock));
@@ -590,7 +589,7 @@
                 goto exit;
             }
 
-            if (dmDecodeC64Image(cimage, fmt, surf, &optSpec) == DMERR_OK)
+            if (dmDecodeC64Image(cimage, surf, &optSpec) == DMERR_OK)
             {
                 title = dm_strdup_printf("%s - [%d / %d] %s (%dx%d @ %s)",
                     dmProgName,
--- a/tools/gfxconv.c	Fri Jun 14 12:08:59 2019 +0300
+++ b/tools/gfxconv.c	Fri Jun 14 12:12:19 2019 +0300
@@ -2227,7 +2227,7 @@
                     }
 
                     // Convert the image
-                    res = dmC64ConvertBMP2Image(&outImage, inC64Image, inC64Fmt, &optC64Spec);
+                    res = dmC64ConvertBMP2Image(&outImage, inC64Image, &optC64Spec);
 
                     if (res != DMERR_OK || outImage == NULL)
                     {
--- a/tools/lib64gfx.c	Fri Jun 14 12:08:59 2019 +0300
+++ b/tools/lib64gfx.c	Fri Jun 14 12:12:19 2019 +0300
@@ -1382,13 +1382,12 @@
 
 // Convert a generic "C64" format bitmap in DMC64Image struct to
 // a indexed/paletted bitmap image.
-int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src,
-    const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
+int dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
 {
     DMC64GetPixelFunc getPixel;
 
     // Sanity check arguments
-    if (dst == NULL || src == NULL || fmt == NULL || spec == NULL)
+    if (dst == NULL || src == NULL || spec == NULL)
         return DMERR_NULLPTR;
 
     if (dst->width != src->fmt->width || dst->height != src->fmt->height)
@@ -1433,13 +1432,12 @@
 }
 
 
-int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src,
-    const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
+int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
 {
     int res;
     DMImage *dst;
 
-    if (pdst == NULL || src == NULL || fmt == NULL || spec == NULL)
+    if (pdst == NULL || src == NULL || spec == NULL)
         return DMERR_NULLPTR;
 
     // Allocate image structure
@@ -1452,10 +1450,10 @@
         return res;
 
     // Convert
-    if (fmt->format->convertFrom != NULL)
-        res = fmt->format->convertFrom(dst, src, fmt, spec);
+    if (src->fmt->convertFrom != NULL)
+        res = src->fmt->convertFrom(dst, src, spec);
     else
-        res = dmC64ConvertGenericBMP2Image(dst, src, fmt, spec);
+        res = dmC64ConvertGenericBMP2Image(dst, src, spec);
 
     return res;
 }
--- a/tools/lib64gfx.h	Fri Jun 14 12:08:59 2019 +0300
+++ b/tools/lib64gfx.h	Fri Jun 14 12:12:19 2019 +0300
@@ -244,7 +244,7 @@
          chWidth, chHeight,  // Width and height in charblocks
          aspectX, aspectY;   // Pixel aspectX/Y
 
-    int  (*convertFrom)(DMImage *, const DMC64Image *, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
+    int  (*convertFrom)(DMImage *, const DMC64Image *, const DMC64ImageConvSpec *spec);
     int  (*convertTo)(DMC64Image *, const DMImage *, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
 
     DMC64GetPixelFunc getPixel;
@@ -383,13 +383,13 @@
 int       dmC64DecodeGenericBMP(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt);
 int       dmC64EncodeGenericBMP(const BOOL allocate, DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt);
 
-int       dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
+int       dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec);
 int       dmC64ConvertImage2BMP(DMC64Image **pdst, const DMImage *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
 
 int       dmC64DecodeBMP(DMC64Image **img, const DMGrowBuf *buf, const size_t probeOffs, const size_t loadOffs, const DMC64ImageFormat **fmt, const DMC64ImageFormat *forced);
 int       dmC64EncodeBMP(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt);
 
-int       dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
+int       dmC64ConvertGenericBMP2Image(DMImage *dst, const DMC64Image *src, const DMC64ImageConvSpec *spec);
 int       dmC64ConvertGenericImage2BMP(DMC64Image *dst, const DMImage *src, const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec);
 
 void      dmGenericRLEAnalyze(const DMGrowBuf *buf, DMCompParams *cfg);