[gimp] plug-ins: fix indexed palette handling in lcms.c



commit b47107123a2d043169bf7df35016f52294489507
Author: Michael Natterer <mitch gimp org>
Date:   Fri Dec 14 21:12:36 2012 +0100

    plug-ins: fix indexed palette handling in lcms.c
    
    gimp_image_get/set_colormap() returns/takes the number of bytes in the
    colormap, not the number of colors.

 plug-ins/common/lcms.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index e6b2f0a..ae689d5 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -1118,10 +1118,10 @@ lcms_image_transform_indexed (gint32                    image,
 {
   cmsHTRANSFORM    transform;
   guchar          *cmap;
-  gint             num_colors;
+  gint             n_cmap_bytes;
   cmsUInt32Number  format = TYPE_RGB_8;
 
-  cmap = gimp_image_get_colormap (image, &num_colors);
+  cmap = gimp_image_get_colormap (image, &n_cmap_bytes);
 
   transform = cmsCreateTransform (src_profile,  format,
                                   dest_profile, format,
@@ -1131,7 +1131,7 @@ lcms_image_transform_indexed (gint32                    image,
 
   if (transform)
     {
-      cmsDoTransform (transform, cmap, cmap, num_colors);
+      cmsDoTransform (transform, cmap, cmap, n_cmap_bytes / 3);
       cmsDeleteTransform (transform);
     }
 
@@ -1140,7 +1140,7 @@ lcms_image_transform_indexed (gint32                    image,
       g_warning ("cmsCreateTransform() failed!");
     }
 
-  gimp_image_set_colormap (image, cmap, num_colors);
+  gimp_image_set_colormap (image, cmap, n_cmap_bytes);
 }
 
 static cmsHPROFILE



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]