diff tools/lib64gfx.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 5477e792def3
children 5db6e0b63b35
line wrap: on
line diff
--- a/tools/lib64gfx.c	Fri Jun 14 12:12:19 2019 +0300
+++ b/tools/lib64gfx.c	Fri Jun 14 12:13:23 2019 +0300
@@ -1043,6 +1043,7 @@
                     case DS_D022:
                     case DS_D023:
                     case DS_D024:
+                    case DS_ILACE_TYPE:
                         switch (op->type)
                         {
                             case DO_COPY:
@@ -1076,6 +1077,7 @@
                             case DS_D022: img->d022 = value; break;
                             case DS_D023: img->d023 = value; break;
                             case DS_D024: img->d024 = value; break;
+                            case DS_ILACE_TYPE: img->laceType = value; break;
                         }
                         break;
 
@@ -1249,6 +1251,7 @@
                     case DS_D022:
                     case DS_D023:
                     case DS_D024:
+                    case DS_ILACE_TYPE:
                         switch (op->subject)
                         {
                             case DS_D020: value = img->d020; break;
@@ -1257,6 +1260,7 @@
                             case DS_D022: value = img->d022; break;
                             case DS_D023: value = img->d023; break;
                             case DS_D024: value = img->d024; break;
+                            case DS_ILACE_TYPE: value = img->laceType; break;
                         }
                         switch (op->type)
                         {
@@ -1434,8 +1438,9 @@
 
 int dmC64ConvertBMP2Image(DMImage **pdst, const DMC64Image *src, const DMC64ImageConvSpec *spec)
 {
+    DMImage *dst;
+    BOOL mixed;
     int res;
-    DMImage *dst;
 
     if (pdst == NULL || src == NULL || spec == NULL)
         return DMERR_NULLPTR;
@@ -1446,7 +1451,8 @@
         return DMERR_MALLOC;
 
     // Set palette information
-    if ((res = dmC64SetImagePalette(dst, spec, FALSE)) != DMERR_OK)
+    mixed = (src->fmt->type & D64_FMT_ILACE) && src->laceType == D64_ILACE_COLOR;
+    if ((res = dmC64SetImagePalette(dst, spec, mixed)) != DMERR_OK)
         return res;
 
     // Convert