From: joncruz Date: Thu, 27 Sep 2007 02:48:50 +0000 (+0000) Subject: Disallow all but RGB Display profiles for previewing X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=231d86283bd86fbce3d5c4f54be3edecaea65834;p=inkscape.git Disallow all but RGB Display profiles for previewing --- diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 46bd1b803..dbd212bd6 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -380,12 +380,27 @@ cmsHPROFILE Inkscape::colorprofile_get_system_profile_handle() if ( which && uri && *uri ) { if ( lastURI != std::string(uri) ) { + lastURI.clear(); if ( theOne ) { cmsCloseProfile( theOne ); } theOne = cmsOpenProfileFromFile( uri, "r" ); if ( theOne ) { - lastURI = uri; + // a display profile must have the proper stuff + icColorSpaceSignature space = cmsGetColorSpace(theOne); + icProfileClassSignature profClass = cmsGetDeviceClass(theOne); + + if ( profClass != icSigDisplayClass ) { + g_warning("Not a display profile"); + cmsCloseProfile( theOne ); + theOne = 0; + } else if ( space != icSigRgbData ) { + g_warning("Not an RGB profile"); + cmsCloseProfile( theOne ); + theOne = 0; + } else { + lastURI = uri; + } } } } else if ( theOne ) {