Code

Block display of named color icc profiles.
[inkscape.git] / src / color-profile.cpp
index 1352e4e1454632da7a32e627d491f92780f97e5a..4c71fd72b47d356f5383abcea339797150da1ba0 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <cstring>
 #include <string>
+#include <io/sys.h>
 
 #ifdef WIN32
 #ifndef _WIN32_WINDOWS         // Allow use of features specific to Windows 98 or later. Required for correctly including icm.h
@@ -557,9 +558,6 @@ bool ColorProfile::GamutCheck(SPColor color){
     return (outofgamut == 255);
 }
 
-
-#include <io/sys.h>
-
 class ProfileInfo
 {
 public:
@@ -724,6 +722,18 @@ static bool isIccFile( gchar const *filepath )
             }
 
             close(fd);
+#if ENABLE_LCMS
+            if (isIccFile) {
+                cmsHPROFILE prof = cmsOpenProfileFromFile( filepath, "r" );
+                if ( prof ) {
+                    icProfileClassSignature profClass = cmsGetDeviceClass(prof);
+                    if ( profClass == icSigNamedColorClass ) {
+                        isIccFile = false; // Ignore named color profiles for now.
+                    }
+                    cmsCloseProfile( prof );
+                }
+            }
+#endif // ENABLE_LCMS
         }
     }
     return isIccFile;
@@ -1182,4 +1192,4 @@ cmsHTRANSFORM Inkscape::colorprofile_get_display_per( Glib::ustring const& id )
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :