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



commit 5818b9eac1432268ffa200113e66a3721cb1e41e
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.
    (cherry picked from commit b47107123a2d043169bf7df35016f52294489507)

 plug-ins/common/lcms.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plug-ins/common/lcms.c b/plug-ins/common/lcms.c
index d2661d8..cb9ff57 100644
--- a/plug-ins/common/lcms.c
+++ b/plug-ins/common/lcms.c
@@ -1004,9 +1004,9 @@ lcms_image_transform_indexed (gint32                    image,
 {
   cmsHTRANSFORM   transform;
   guchar         *cmap;
-  gint            num_colors;
+  gint            n_cmap_bytes;
 
-  cmap = gimp_image_get_colormap (image, &num_colors);
+  cmap = gimp_image_get_colormap (image, &n_cmap_bytes);
 
   transform = cmsCreateTransform (src_profile,  TYPE_RGB_8,
                                   dest_profile, TYPE_RGB_8,
@@ -1015,15 +1015,15 @@ lcms_image_transform_indexed (gint32                    image,
 
   if (transform)
     {
-      cmsDoTransform (transform, cmap, cmap, num_colors);
-      cmsDeleteTransform(transform);
+      cmsDoTransform (transform, cmap, cmap, n_cmap_bytes / 3);
+      cmsDeleteTransform (transform);
     }
   else
     {
       g_warning ("cmsCreateTransform() failed!");
     }
 
-  gimp_image_set_colormap (image, cmap, num_colors);
+  gimp_image_set_colormap (image, cmap, n_cmap_bytes);
 }
 
 static void



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