[gimp] Bug 751553: Linear precision doesn't display the image correctly



commit 688861cd34aaf0214306ed570ce096b075e75ce2
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Fri Jul 10 23:06:53 2015 +0200

    Bug 751553: Linear precision doesn't display the image correctly
    
    gimp_color_profile_is_equal(): byte-by-byte compare the entire profile
    *except* the header, instead of only the header, which was wrong.

 libgimpcolor/gimpcolorprofile.c |   20 +++++---------------
 1 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/libgimpcolor/gimpcolorprofile.c b/libgimpcolor/gimpcolorprofile.c
index f57a27d..ce1937c 100644
--- a/libgimpcolor/gimpcolorprofile.c
+++ b/libgimpcolor/gimpcolorprofile.c
@@ -55,9 +55,6 @@
  **/
 
 
-#define GIMP_LCMS_MD5_DIGEST_LENGTH 16
-
-
 struct _GimpColorProfilePrivate
 {
   cmsHPROFILE  lcms_profile;
@@ -578,22 +575,15 @@ gboolean
 gimp_color_profile_is_equal (GimpColorProfile *profile1,
                              GimpColorProfile *profile2)
 {
-  cmsUInt8Number digest1[GIMP_LCMS_MD5_DIGEST_LENGTH];
-  cmsUInt8Number digest2[GIMP_LCMS_MD5_DIGEST_LENGTH];
+  const gsize header_len = sizeof (cmsICCHeader);
 
   g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
   g_return_val_if_fail (GIMP_IS_COLOR_PROFILE (profile1), FALSE);
 
-  if (! cmsMD5computeID (profile1->priv->lcms_profile) ||
-      ! cmsMD5computeID (profile2->priv->lcms_profile))
-    {
-      return FALSE;
-    }
-
-  cmsGetHeaderProfileID (profile1->priv->lcms_profile, digest1);
-  cmsGetHeaderProfileID (profile2->priv->lcms_profile, digest2);
-
-  return (memcmp (digest1, digest2, GIMP_LCMS_MD5_DIGEST_LENGTH) == 0);
+  return (profile1->priv->length == profile2->priv->length &&
+          memcmp (profile1->priv->data + header_len,
+                  profile2->priv->data + header_len,
+                  profile1->priv->length - header_len) == 0);
 }
 
 /**


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