Code

refactoring ICC out-of-gamut check
authorJucaBlues <JucaBlues@users.sourceforge.net>
Sat, 15 Aug 2009 05:25:49 +0000 (05:25 +0000)
committerJucaBlues <JucaBlues@users.sourceforge.net>
Sat, 15 Aug 2009 05:25:49 +0000 (05:25 +0000)
src/widgets/sp-color-notebook.cpp

index 5eb44c2cb3d8b4ab1805d38f42db37d9b250a91c..52c78ba42af754871279493b9a8a6c034e8b6434 100644 (file)
@@ -511,15 +511,13 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha )
     /* update out-of-gamut icon */
     gtk_widget_set_sensitive (_box_outofgamut, false);
     if (color.icc){
-        BYTE outofgamut;
-        cmsSetAlarmCodes(255, 255, 255);
+        BYTE outofgamut = 0;
         static cmsHPROFILE hNULL = cmsCreateNULLProfile();
         static cmsHPROFILE hsRGB = cmsCreate_sRGBProfile();
 
-        cmsHTRANSFORM trans;
         Inkscape::ColorProfile* target_profile = SP_ACTIVE_DOCUMENT->profileManager->find(color.icc->colorProfile.c_str());
         if ( target_profile ) {
-            trans = cmsCreateProofingTransform(hsRGB, TYPE_RGB_DBL, hNULL, TYPE_GRAY_8, target_profile->profHandle,
+            cmsHTRANSFORM trans = cmsCreateProofingTransform(hsRGB, TYPE_RGBA_8, hNULL, TYPE_GRAY_8, target_profile->profHandle,
              INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, (cmsFLAGS_GAMUTCHECK|cmsFLAGS_SOFTPROOFING));
 
             if ( trans ) {
@@ -530,7 +528,11 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha )
                     SP_RGBA32_B_U(val),
                     255};
 
+                int alarm_r, alarm_g, alarm_b;
+                cmsGetAlarmCodes(&alarm_r, &alarm_g, &alarm_b);
+                cmsSetAlarmCodes(255, 255, 255);
                 cmsDoTransform(trans, &check_color, &outofgamut, 1);
+                cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b);
                 gtk_widget_set_sensitive (_box_outofgamut, outofgamut == 255);
             }
         }