diff tools/lib64fmts.c @ 2224:a36c81c3df85

Make color interlace type generate a mixed palette instead of using special decode functions for it.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 14 Jun 2019 12:13:23 +0300
parents 75b5bb490f38
children 5db6e0b63b35
line wrap: on
line diff
--- a/tools/lib64fmts.c	Fri Jun 14 12:12:19 2019 +0300
+++ b/tools/lib64fmts.c	Fri Jun 14 12:13:23 2019 +0300
@@ -745,17 +745,6 @@
 }
 
 
-static int fmtTruePaintGetLaceType(const DMC64EncDecOp *op, DMC64Image *img,
-    const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt)
-{
-    (void) op;
-    (void) buf;
-    (void) fmt;
-    img->laceType = D64_ILACE_RES;
-    return DMERR_OK;
-}
-
-
 static int fmtGetPixelTruePaint(Uint8 *col,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
@@ -1512,17 +1501,6 @@
 }
 
 
-static int fmtECIGetLaceType(const DMC64EncDecOp *op, DMC64Image *img,
-    const DMGrowBuf *buf, const DMC64ImageCommonFormat *fmt)
-{
-    (void) op;
-    (void) buf;
-    (void) fmt;
-    img->laceType = D64_ILACE_COLOR;
-    return DMERR_OK;
-}
-
-
 static int fmtGetPixelECI(Uint8 *col,
     const DMC64Image *img, const int rasterX, const int rasterY)
 {
@@ -1540,18 +1518,6 @@
 }
 
 
-static int fmtConvertECIBMP2Image(DMImage *dst, const DMC64Image *src,
-    const DMC64ImageFormat *fmt, const DMC64ImageConvSpec *spec)
-{
-    int res;
-
-    if ((res = dmC64SetImagePalette(dst, spec, TRUE)) != DMERR_OK)
-        return res;
-
-    return dmC64ConvertGenericBMP2Image(dst, src, fmt, spec);
-}
-
-
 static int fmtProbeECIPacked(const DMGrowBuf *buf, const DMC64ImageFormat *fmt)
 {
     int score = DM_PROBE_SCORE_FALSE;
@@ -1720,15 +1686,15 @@
         NULL, NULL,
         fmtGetPixelFunPaint2,
         {
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM, 0x0000, 0, 0x400, 0, DF_NORMAL),
-            { DO_COPY       , DS_BITMAP_RAM  , 0x2000, 0,  0  , 0, NULL, NULL, DF_NORMAL },
-            { DO_COPY       , DS_EXTRA_DATA  , 0x3f48, 0,  100, 0, NULL, NULL, DF_NORMAL },
-            { DO_COPY       , DS_COLOR_RAM   , 0x4000, 0,  0  , 0, NULL, NULL, DF_NORMAL },
-            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM, 0x43e8, 8, 0x400, 0, DF_NORMAL),
-            { DO_COPY       , DS_BITMAP_RAM  , 0x63e8, 1,  0  , 0, NULL, NULL, DF_NORMAL },
-            { DO_COPY       , DS_EXTRA_DATA  , 0x8328, 0,  100, 100, NULL, NULL, DF_NORMAL },
-            { DO_FUNC       , 0              , 0     , 0,  1  , 0, fmtTruePaintGetLaceType, NULL, DF_NORMAL },
-            { DO_LAST       , 0              , 0     , 0,  0  , 0, NULL, NULL, DF_NORMAL },
+            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x0000, 0,  0x400, 0, DF_NORMAL),
+            { DO_COPY       , DS_BITMAP_RAM  , 0x2000, 0,  0    , 0, NULL, NULL, DF_NORMAL },
+            { DO_COPY       , DS_EXTRA_DATA  , 0x3f48, 0,  100  , 0, NULL, NULL, DF_NORMAL },
+            { DO_COPY       , DS_COLOR_RAM   , 0x4000, 0,  0    , 0, NULL, NULL, DF_NORMAL },
+            DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x43e8, 8,  0x400, 0, DF_NORMAL),
+            { DO_COPY       , DS_BITMAP_RAM  , 0x63e8, 1,  0    , 0, NULL, NULL, DF_NORMAL },
+            { DO_COPY       , DS_EXTRA_DATA  , 0x8328, 0,  100  , 100, NULL, NULL, DF_NORMAL },
+            { DO_SET_OP     , DS_ILACE_TYPE  , D64_ILACE_RES, 0 , 0  , 0, NULL, NULL, DF_DECODE },
+            { DO_LAST       , 0              , 0     , 0,  0    , 0, NULL, NULL, DF_NORMAL },
         }
     },
 
@@ -1780,24 +1746,24 @@
             { DO_COPY       , DS_BITMAP_RAM  , 0x2400, 1,  0,   0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_SCREEN_RAM  , 0x4400, 1,  0,   0, NULL, NULL, DF_NORMAL },
             { DO_COPY       , DS_COLOR_RAM   , 0x4800, 0,  0,   0, NULL, NULL, DF_NORMAL },
-            { DO_FUNC       , 0              , 0x0000, 0,  0,   0, fmtTruePaintGetLaceType, NULL, DF_NORMAL },
+            { DO_SET_OP     , DS_ILACE_TYPE  , D64_ILACE_RES, 0 , 0  , 0, NULL, NULL, DF_DECODE },
             { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL, DF_NORMAL },
         }
     },
 
     { // #7: ECI Graphic Editor Hires FLI
-        D64_FMT_HIRES | D64_FMT_FLI,
+        D64_FMT_HIRES | D64_FMT_FLI | D64_FMT_ILACE,
         D64_SCR_WIDTH,    D64_SCR_HEIGHT,
         D64_SCR_CH_WIDTH, D64_SCR_CH_HEIGHT,
         1, 1,
-        fmtConvertECIBMP2Image, NULL,
+        NULL, NULL,
         fmtGetPixelECI,
         {
             { DO_COPY       , DS_BITMAP_RAM  , 0x0000, 0,  0,   0, NULL, NULL, DF_NORMAL },
             DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x2000, 0, 0x400, 0, DF_NORMAL),
             { DO_COPY       , DS_BITMAP_RAM  , 0x4000, 1,  0,   0, NULL, NULL, DF_NORMAL },
             DEF_REPEAT_BLOCK_8(DS_SCREEN_RAM , 0x6000, 8, 0x400, 0, DF_NORMAL),
-            { DO_FUNC       , 0              , 0     , 0,  0,   0, fmtECIGetLaceType, NULL, DF_NORMAL },
+            { DO_SET_OP     , DS_ILACE_TYPE  , D64_ILACE_COLOR, 0 , 0  , 0, NULL, NULL, DF_DECODE },
             { DO_LAST       , 0              , 0     , 0,  0,   0, NULL, NULL, DF_NORMAL },
         }
     },
@@ -2463,7 +2429,7 @@
                 // GunPaint does not store the last 3 d021 values .. so set them to black
                 // XXX TODO: According to some, the last 4 should be same ..
                 { DO_SET_MEM    , DS_EXTRA_DATA  , 0     , 0,  3  , 20+177, NULL, NULL, DF_NORMAL },
-                { DO_FUNC       , 0              , 0x2742, 0,  1  , 0, fmtTruePaintGetLaceType, NULL, DF_NORMAL },
+                { DO_SET_OP     , DS_ILACE_TYPE  , D64_ILACE_RES, 0 , 0  , 0, NULL, NULL, DF_DECODE },
                 { DO_FUNC       , 0              , 0     , 0,  0  , 0, NULL, fmtEncodeGunPaint, DF_NORMAL },
                 { DO_LAST       , 0              , 0     , 0,  0  , 0, NULL, NULL, DF_NORMAL },
             }