diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2012-02-13 09:27:56 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2012-02-13 09:27:56 +0000 |
| commit | 33e08823fec6157953453a938b10e2c731c8e1df (patch) | |
| tree | f0c0214357fb5faeef6e2214d075384e72eccb8f /src | |
| parent | Fix wrong placement in authors (diff) | |
| download | inkscape-33e08823fec6157953453a938b10e2c731c8e1df.tar.gz inkscape-33e08823fec6157953453a938b10e2c731c8e1df.zip | |
Enable LCMS2 for other than OSX, where it still has some issues. Fixes bug #885324.
Fixed bugs:
- https://launchpad.net/bugs/885324
(bzr r10969)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cms-color-types.h | 40 | ||||
| -rw-r--r-- | src/color-profile-cms-fns.h | 24 | ||||
| -rw-r--r-- | src/color-profile.cpp | 276 | ||||
| -rw-r--r-- | src/color-profile.h | 16 | ||||
| -rw-r--r-- | src/display/nr-filter-flood.cpp | 5 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 10 | ||||
| -rw-r--r-- | src/display/sp-canvas.h | 4 | ||||
| -rw-r--r-- | src/sp-image.cpp | 36 | ||||
| -rw-r--r-- | src/sp-image.h | 4 | ||||
| -rw-r--r-- | src/svg/svg-color.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 20 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.h | 8 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 12 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 38 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.cpp | 116 | ||||
| -rw-r--r-- | src/widgets/sp-color-icc-selector.h | 8 | ||||
| -rw-r--r-- | src/widgets/sp-color-notebook.cpp | 16 | ||||
| -rw-r--r-- | src/widgets/sp-color-notebook.h | 4 |
18 files changed, 395 insertions, 250 deletions
diff --git a/src/cms-color-types.h b/src/cms-color-types.h index ec285a8a2..c79b114a7 100644 --- a/src/cms-color-types.h +++ b/src/cms-color-types.h @@ -1,16 +1,53 @@ #ifndef SEEN_CMS_COLOR_TYPES_H #define SEEN_CMS_COLOR_TYPES_H -/** \file +/** + * @file * A simple abstraction to provide opaque compatibility with either lcms or lcms2. */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif // HAVE_CONFIG_H + #include <glib.h> +#if HAVE_LIBLCMS1 +# include <icc34.h> +#endif typedef void * cmsHPROFILE; typedef void * cmsHTRANSFORM; +#if HAVE_LIBLCMS1 +typedef icColorSpaceSignature cmsColorSpaceSignature; +typedef icProfileClassSignature cmsProfileClassSignature; + +#define cmsSigInputClass icSigInputClass +#define cmsSigDisplayClass icSigDisplayClass +#define cmsSigOutputClass icSigOutputClass +#define cmsSigNamedColorClass icSigNamedColorClass + +#define cmsSigRgbData icSigRgbData + +#define cmsSigXYZData icSigXYZData +#define cmsSigLabData icSigLabData +#define cmsSigLuvData icSigLuvData +#define cmsSigYCbCrData icSigYCbCrData +#define cmsSigYxyData icSigYxyData +#define cmsSigRgbData icSigRgbData +#define cmsSigGrayData icSigGrayData +#define cmsSigHsvData icSigHsvData +#define cmsSigHlsData icSigHlsData +#define cmsSigCmykData icSigCmykData +#define cmsSigCmyData icSigCmyData + +typedef uint32_t cmsUInt32Number; +typedef uint16_t cmsUInt16Number; +typedef uint8_t cmsUInt8Number; + +#endif // HAVE_LIBLCMS1 + namespace Inkscape { /** @@ -44,6 +81,7 @@ protected: } // namespace Inkscape + #endif // SEEN_CMS_COLOR_TYPES_H /* diff --git a/src/color-profile-cms-fns.h b/src/color-profile-cms-fns.h index fe0eed392..9e5f64a9c 100644 --- a/src/color-profile-cms-fns.h +++ b/src/color-profile-cms-fns.h @@ -1,38 +1,40 @@ #ifndef SEEN_COLOR_PROFILE_CMS_FNS_H #define SEEN_COLOR_PROFILE_CMS_FNS_H -#if ENABLE_LCMS -#include <lcms.h> -#endif // ENABLE_LCMS +#if HAVE_LIBLCMS2 +# include <lcms2.h> +#elif HAVE_LIBLCMS1 +# include <lcms.h> +#endif // HAVE_LIBLCMS2 #include "cms-color-types.h" namespace Inkscape { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) // Note: these can later be adjusted to adapt for lcms2: class ColorSpaceSigWrapper : public ColorSpaceSig { public : - ColorSpaceSigWrapper( icColorSpaceSignature sig ) : ColorSpaceSig( static_cast<guint32>(sig) ) {} + ColorSpaceSigWrapper( cmsColorSpaceSignature sig ) : ColorSpaceSig( static_cast<guint32>(sig) ) {} ColorSpaceSigWrapper( ColorSpaceSig const &other ) : ColorSpaceSig( other ) {} - operator icColorSpaceSignature() const { return static_cast<icColorSpaceSignature>(value); } + operator cmsColorSpaceSignature() const { return static_cast<cmsColorSpaceSignature>(value); } }; class ColorProfileClassSigWrapper : public ColorProfileClassSig { public : - ColorProfileClassSigWrapper( icProfileClassSignature sig ) : ColorProfileClassSig( static_cast<guint32>(sig) ) {} + ColorProfileClassSigWrapper( cmsProfileClassSignature sig ) : ColorProfileClassSig( static_cast<guint32>(sig) ) {} ColorProfileClassSigWrapper( ColorProfileClassSig const &other ) : ColorProfileClassSig( other ) {} - operator icProfileClassSignature() const { return static_cast<icProfileClassSignature>(value); } + operator cmsProfileClassSignature() const { return static_cast<cmsProfileClassSignature>(value); } }; -icColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig); -icProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig); +cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig); +cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } // namespace Inkscape diff --git a/src/color-profile.cpp b/src/color-profile.cpp index cc9e7a6cb..141de921d 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -24,9 +24,11 @@ #include <windows.h> #endif -#if ENABLE_LCMS -#include <lcms.h> -#endif // ENABLE_LCMS +#if HAVE_LIBLCMS2 +# include <lcms2.h> +#elif HAVE_LIBLCMS1 +# include <lcms.h> +#endif // HAVE_LIBLCMS2 #include "xml/repr.h" #include "color.h" @@ -51,12 +53,12 @@ using Inkscape::ColorProfileImpl; namespace { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) cmsHPROFILE getSystemProfileHandle(); cmsHPROFILE getProofProfileHandle(); void loadProfiles(); Glib::ustring getNameFromProfile(cmsHPROFILE profile); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } #ifdef DEBUG_LCMS @@ -103,15 +105,15 @@ static SPObjectClass *cprof_parent_class; class ColorProfileImpl { public: -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) static cmsHPROFILE _sRGBProf; static cmsHPROFILE _NullProf; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) ColorProfileImpl(); -#if ENABLE_LCMS - static DWORD _getInputFormat( icColorSpaceSignature space ); +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + static cmsUInt32Number _getInputFormat( cmsColorSpaceSignature space ); static cmsHPROFILE getNULLProfile(); static cmsHPROFILE getSRGBProfile(); @@ -119,46 +121,46 @@ public: void _clearProfile(); cmsHPROFILE _profHandle; - icProfileClassSignature _profileClass; - icColorSpaceSignature _profileSpace; + cmsProfileClassSignature _profileClass; + cmsColorSpaceSignature _profileSpace; cmsHTRANSFORM _transf; cmsHTRANSFORM _revTransf; cmsHTRANSFORM _gamutTransf; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) }; namespace Inkscape { -#ifdef ENABLE_LCMS -icColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig) +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig) { return ColorSpaceSigWrapper(sig); } -icProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig) +cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig) { return ColorProfileClassSigWrapper(sig); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } // namespace Inkscape ColorProfileImpl::ColorProfileImpl() -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) : _profHandle(0), - _profileClass(icSigInputClass), - _profileSpace(icSigRgbData), + _profileClass(cmsSigInputClass), + _profileSpace(cmsSigRgbData), _transf(0), _revTransf(0), _gamutTransf(0) -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) { } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) cmsHPROFILE ColorProfileImpl::_sRGBProf = 0; @@ -178,7 +180,7 @@ cmsHPROFILE ColorProfileImpl::getNULLProfile() { return _NullProf; } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /** * Register ColorProfile class and return its type. @@ -267,18 +269,18 @@ void ColorProfile::release( SPObject *object ) cprof->intentStr = 0; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) cprof->impl->_clearProfile(); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) delete cprof->impl; cprof->impl = 0; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorProfileImpl::_clearProfile() { - _profileSpace = icSigRgbData; + _profileSpace = cmsSigRgbData; if ( _transf ) { cmsDeleteTransform( _transf ); @@ -297,7 +299,7 @@ void ColorProfileImpl::_clearProfile() _profHandle = 0; } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /** * Callback: set attributes from associated repr. @@ -340,12 +342,14 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) if ( value ) { cprof->href = g_strdup( value ); if ( *cprof->href ) { -#if ENABLE_LCMS +#if HAVE_LIBLCMS1 cmsErrorAction( LCMS_ERROR_SHOW ); +#endif +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) // TODO open filename and URIs properly //FILE* fp = fopen_utf8name( filename, "r" ); - //LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, DWORD dwSize); + //LCMSAPI cmsHPROFILE LCMSEXPORT cmsOpenProfileFromMem(LPVOID MemPtr, cmsUInt32Number dwSize); // Try to open relative SPDocument *doc = object->document; @@ -381,7 +385,7 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) g_free(escaped); escaped = 0; g_free(fullname); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } } object->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -478,27 +482,27 @@ Inkscape::XML::Node* ColorProfile::write( SPObject *object, Inkscape::XML::Docum } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) struct MapMap { - icColorSpaceSignature space; - DWORD inForm; + cmsColorSpaceSignature space; + cmsUInt32Number inForm; }; -DWORD ColorProfileImpl::_getInputFormat( icColorSpaceSignature space ) +cmsUInt32Number ColorProfileImpl::_getInputFormat( cmsColorSpaceSignature space ) { MapMap possible[] = { - {icSigXYZData, TYPE_XYZ_16}, - {icSigLabData, TYPE_Lab_16}, - //icSigLuvData - {icSigYCbCrData, TYPE_YCbCr_16}, - {icSigYxyData, TYPE_Yxy_16}, - {icSigRgbData, TYPE_RGB_16}, - {icSigGrayData, TYPE_GRAY_16}, - {icSigHsvData, TYPE_HSV_16}, - {icSigHlsData, TYPE_HLS_16}, - {icSigCmykData, TYPE_CMYK_16}, - {icSigCmyData, TYPE_CMY_16}, + {cmsSigXYZData, TYPE_XYZ_16}, + {cmsSigLabData, TYPE_Lab_16}, + //cmsSigLuvData + {cmsSigYCbCrData, TYPE_YCbCr_16}, + {cmsSigYxyData, TYPE_Yxy_16}, + {cmsSigRgbData, TYPE_RGB_16}, + {cmsSigGrayData, TYPE_GRAY_16}, + {cmsSigHsvData, TYPE_HSV_16}, + {cmsSigHlsData, TYPE_HLS_16}, + {cmsSigCmykData, TYPE_CMYK_16}, + {cmsSigCmyData, TYPE_CMY_16}, }; int index = 0; @@ -601,54 +605,82 @@ cmsHTRANSFORM ColorProfile::getTransfFromSRGB8() cmsHTRANSFORM ColorProfile::getTransfGamutCheck() { if ( !impl->_gamutTransf ) { - impl->_gamutTransf = cmsCreateProofingTransform(ColorProfileImpl::getSRGBProfile(), TYPE_BGRA_8, ColorProfileImpl::getNULLProfile(), TYPE_GRAY_8, impl->_profHandle, INTENT_RELATIVE_COLORIMETRIC, INTENT_RELATIVE_COLORIMETRIC, (cmsFLAGS_GAMUTCHECK|cmsFLAGS_SOFTPROOFING)); + impl->_gamutTransf = cmsCreateProofingTransform(ColorProfileImpl::getSRGBProfile(), + TYPE_BGRA_8, + ColorProfileImpl::getNULLProfile(), + TYPE_GRAY_8, + impl->_profHandle, + INTENT_RELATIVE_COLORIMETRIC, + INTENT_RELATIVE_COLORIMETRIC, + (cmsFLAGS_GAMUTCHECK | cmsFLAGS_SOFTPROOFING)); } return impl->_gamutTransf; } bool ColorProfile::GamutCheck(SPColor color) { - BYTE outofgamut = 0; + bool result = false; guint32 val = color.toRGBA32(0); + +#if HAVE_LIBLCMS1 + int alarm_r = 0; + int alarm_g = 0; + int alarm_b = 0; + cmsGetAlarmCodes(&alarm_r, &alarm_g, &alarm_b); + cmsSetAlarmCodes(255, 255, 255); +#elif HAVE_LIBLCMS2 + cmsUInt16Number oldAlarmCodes[cmsMAXCHANNELS] = {0}; + cmsGetAlarmCodes(oldAlarmCodes); + cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; + newAlarmCodes[0] = ~0; + cmsSetAlarmCodes(newAlarmCodes); +#endif // HAVE_LIBLCMS1 + + cmsUInt8Number outofgamut = 0; guchar check_color[4] = { SP_RGBA32_R_U(val), SP_RGBA32_G_U(val), 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(ColorProfile::getTransfGamutCheck(), &check_color, &outofgamut, 1); + +#if HAVE_LIBLCMS1 cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b); - return (outofgamut == 255); +#elif HAVE_LIBLCMS2 + cmsSetAlarmCodes(oldAlarmCodes); +#endif // HAVE_LIBLCMS1 + + result = (outofgamut != 0); + + return result; } class ProfileInfo { public: - ProfileInfo( cmsHPROFILE, Glib::ustring const & path ); + ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path ); Glib::ustring const& getName() {return _name;} Glib::ustring const& getPath() {return _path;} - icColorSpaceSignature getSpace() {return _profileSpace;} - icProfileClassSignature getClass() {return _profileClass;} + cmsColorSpaceSignature getSpace() {return _profileSpace;} + cmsProfileClassSignature getClass() {return _profileClass;} private: Glib::ustring _path; Glib::ustring _name; - icColorSpaceSignature _profileSpace; - icProfileClassSignature _profileClass; + cmsColorSpaceSignature _profileSpace; + cmsProfileClassSignature _profileClass; }; +#include <iostream> -ProfileInfo::ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path ) +ProfileInfo::ProfileInfo( cmsHPROFILE prof, Glib::ustring const & path ) : + _path( path ), + _name( getNameFromProfile(prof) ), + _profileSpace( cmsGetColorSpace( prof ) ), + _profileClass( cmsGetDeviceClass( prof ) ) { - _path = path; - _name = cmsTakeProductDesc(prof); - _profileSpace = cmsGetColorSpace( prof ); - _profileClass = cmsGetDeviceClass( prof ); } @@ -661,10 +693,11 @@ std::vector<Glib::ustring> Inkscape::CMSSystem::getDisplayNames() std::vector<Glib::ustring> result; for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) { - if ( it->getClass() == icSigDisplayClass && it->getSpace() == icSigRgbData ) { + if ( it->getClass() == cmsSigDisplayClass && it->getSpace() == cmsSigRgbData ) { result.push_back( it->getName() ); } } + std::sort(result.begin(), result.end()); return result; } @@ -675,10 +708,11 @@ std::vector<Glib::ustring> Inkscape::CMSSystem::getSoftproofNames() std::vector<Glib::ustring> result; for ( std::vector<ProfileInfo>::iterator it = knownProfiles.begin(); it != knownProfiles.end(); ++it ) { - if ( it->getClass() == icSigOutputClass ) { + if ( it->getClass() == cmsSigOutputClass ) { result.push_back( it->getName() ); } } + std::sort(result.begin(), result.end()); return result; } @@ -708,7 +742,7 @@ bool Inkscape::CMSSystem::isPrintColorSpace(ColorProfile const *profile) bool isPrint = false; if ( profile ) { ColorSpaceSigWrapper colorspace = profile->getColorSpace(); - isPrint = (colorspace == icSigCmykData) || (colorspace == icSigCmyData); + isPrint = (colorspace == cmsSigCmykData) || (colorspace == cmsSigCmyData); } return isPrint; } @@ -717,21 +751,27 @@ gint Inkscape::CMSSystem::getChannelCount(ColorProfile const *profile) { gint count = 0; if ( profile ) { +#if HAVE_LIBLCMS1 count = _cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) ); +#elif HAVE_LIBLCMS2 + count = cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) ); +#endif } return count; } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) static bool warnSet = false; if (!warnSet) { +#if HAVE_LIBLCMS1 cmsErrorAction( LCMS_ERROR_SHOW ); +#endif warnSet = true; } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) std::vector<Glib::ustring> sources; gchar* base = profile_path("XXX"); @@ -779,7 +819,7 @@ std::vector<Glib::ustring> ColorProfile::getBaseProfileDirs() { #ifdef WIN32 wchar_t pathBuf[MAX_PATH + 1]; pathBuf[0] = 0; - DWORD pathSize = sizeof(pathBuf); + cmsUInt32Number pathSize = sizeof(pathBuf); g_assert(sizeof(wchar_t) == sizeof(gunichar2)); if ( GetColorDirectoryW( NULL, pathBuf, &pathSize ) ) { gchar * utf8Path = g_utf16_to_utf8( (gunichar2*)(&pathBuf[0]), -1, NULL, NULL, NULL ); @@ -817,18 +857,18 @@ static bool isIccFile( gchar const *filepath ) } close(fd); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (isIccFile) { cmsHPROFILE prof = cmsOpenProfileFromFile( filepath, "r" ); if ( prof ) { - icProfileClassSignature profClass = cmsGetDeviceClass(prof); - if ( profClass == icSigNamedColorClass ) { + cmsProfileClassSignature profClass = cmsGetDeviceClass(prof); + if ( profClass == cmsSigNamedColorClass ) { isIccFile = false; // Ignore named color profiles for now. } cmsCloseProfile( prof ); } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } } return isIccFile; @@ -874,14 +914,11 @@ std::vector<Glib::ustring> ColorProfile::getProfileFiles() return files; } -#if ENABLE_LCMS -#endif // ENABLE_LCMS - std::vector<std::pair<Glib::ustring, Glib::ustring> > ColorProfile::getProfileFilesWithNames() { std::vector<std::pair<Glib::ustring, Glib::ustring> > result; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) std::vector<Glib::ustring> files = getProfileFiles(); for ( std::vector<Glib::ustring>::const_iterator it = files.begin(); it != files.end(); ++it ) { cmsHPROFILE hProfile = cmsOpenProfileFromFile(it->c_str(), "r"); @@ -891,34 +928,64 @@ std::vector<std::pair<Glib::ustring, Glib::ustring> > ColorProfile::getProfileFi cmsCloseProfile(hProfile); } } -#endif // ENABLE_LCMS + std::sort(result.begin(), result.end()); +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) return result; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if HAVE_LIBLCMS1 int errorHandlerCB(int ErrorCode, const char *ErrorText) { g_message("lcms: Error %d; %s", ErrorCode, ErrorText); return 1; } +#elif HAVE_LIBLCMS2 +void errorHandlerCB(cmsContext /*contextID*/, cmsUInt32Number errorCode, char const *errorText) +{ + g_message("lcms: Error %d", errorCode); + g_message(" %p", errorText); + //g_message("lcms: Error %d; %s", errorCode, errorText); +} +#endif namespace { + Glib::ustring getNameFromProfile(cmsHPROFILE profile) { - gchar const *name = 0; + Glib::ustring nameStr; if ( profile ) { - name = cmsTakeProductDesc(profile); +#if HAVE_LIBLCMS1 + gchar const *name = cmsTakeProductDesc(profile); if ( !name ) { name = cmsTakeProductName(profile); } if ( name && !g_utf8_validate(name, -1, NULL) ) { name = _("(invalid UTF-8 string)"); } + nameStr = (name) ? name : _("None"); +#elif HAVE_LIBLCMS2 + cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", NULL, 0); + if (byteLen > 0) { + // TODO investigate wchar_t and cmsGetProfileInfo() + std::vector<char> data(byteLen); + cmsUInt32Number readLen = cmsGetProfileInfoASCII(profile, cmsInfoDescription, + "en", "US", + data.data(), data.size()); + if (readLen < data.size()) { + data.resize(readLen); + } + nameStr = Glib::ustring(data.begin(), data.end()); } - return (name) ? name : _("None"); + if (nameStr.empty()) { + nameStr = _("(invalid UTF-8 string)"); + } +#endif + } + return nameStr; } /** @@ -929,7 +996,12 @@ void loadProfiles() { static bool error_handler_set = false; if (!error_handler_set) { +#if HAVE_LIBLCMS1 cmsSetErrorHandler(errorHandlerCB); +#elif HAVE_LIBLCMS2 + //cmsSetLogErrorHandler(errorHandlerCB); + //g_message("LCMS error handler set"); +#endif error_handler_set = true; } @@ -997,14 +1069,14 @@ cmsHPROFILE getSystemProfileHandle() theOne = cmsOpenProfileFromFile( uri.data(), "r" ); if ( theOne ) { // a display profile must have the proper stuff - icColorSpaceSignature space = cmsGetColorSpace(theOne); - icProfileClassSignature profClass = cmsGetDeviceClass(theOne); + cmsColorSpaceSignature space = cmsGetColorSpace(theOne); + cmsProfileClassSignature profClass = cmsGetDeviceClass(theOne); - if ( profClass != icSigDisplayClass ) { + if ( profClass != cmsSigDisplayClass ) { g_warning("Not a display profile"); cmsCloseProfile( theOne ); theOne = 0; - } else if ( space != icSigRgbData ) { + } else if ( space != cmsSigRgbData ) { g_warning("Not an RGB profile"); cmsCloseProfile( theOne ); theOne = 0; @@ -1051,17 +1123,17 @@ cmsHPROFILE getProofProfileHandle() theOne = cmsOpenProfileFromFile( uri.data(), "r" ); if ( theOne ) { // a display profile must have the proper stuff - icColorSpaceSignature space = cmsGetColorSpace(theOne); - icProfileClassSignature profClass = cmsGetDeviceClass(theOne); + cmsColorSpaceSignature space = cmsGetColorSpace(theOne); + cmsProfileClassSignature profClass = cmsGetDeviceClass(theOne); (void)space; (void)profClass; /* - if ( profClass != icSigDisplayClass ) { + if ( profClass != cmsSigDisplayClass ) { g_warning("Not a display profile"); cmsCloseProfile( theOne ); theOne = 0; - } else if ( space != icSigRgbData ) { + } else if ( space != cmsSigRgbData ) { g_warning("Not an RGB profile"); cmsCloseProfile( theOne ); theOne = 0; @@ -1137,10 +1209,19 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform() if ( !transf ) { if ( hprof && proofProf ) { - DWORD dwFlags = cmsFLAGS_SOFTPROOFING; + cmsUInt32Number dwFlags = cmsFLAGS_SOFTPROOFING; if ( gamutWarn ) { dwFlags |= cmsFLAGS_GAMUTCHECK; +#if HAVE_LIBLCMS1 cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8); +#elif HAVE_LIBLCMS2 + cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; + newAlarmCodes[0] = gamutColor.get_red(); + newAlarmCodes[1] = gamutColor.get_green(); + newAlarmCodes[2] = gamutColor.get_blue(); + newAlarmCodes[3] = ~0; + cmsSetAlarmCodes(newAlarmCodes); +#endif } if ( bpc ) { dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; @@ -1297,10 +1378,19 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) if ( !item.transf ) { if ( item.hprof && proofProf ) { - DWORD dwFlags = cmsFLAGS_SOFTPROOFING; + cmsUInt32Number dwFlags = cmsFLAGS_SOFTPROOFING; if ( gamutWarn ) { dwFlags |= cmsFLAGS_GAMUTCHECK; +#if HAVE_LIBLCMS1 cmsSetAlarmCodes(gamutColor.get_red() >> 8, gamutColor.get_green() >> 8, gamutColor.get_blue() >> 8); +#elif HAVE_LIBLCMS2 + cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; + newAlarmCodes[0] = gamutColor.get_red(); + newAlarmCodes[1] = gamutColor.get_green(); + newAlarmCodes[2] = gamutColor.get_blue(); + newAlarmCodes[3] = ~0; + cmsSetAlarmCodes(newAlarmCodes); +#endif } if ( bpc ) { dwFlags |= cmsFLAGS_BLACKPOINTCOMPENSATION; @@ -1327,7 +1417,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Local Variables: diff --git a/src/color-profile.h b/src/color-profile.h index 8b23c1b04..184481ce8 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -1,10 +1,6 @@ #ifndef SEEN_COLOR_PROFILE_H #define SEEN_COLOR_PROFILE_H -/** \file - * SPColorProfile: SVG <color-profile> implementation - */ - #include <vector> #include <glib.h> #include <sp-object.h> @@ -27,12 +23,16 @@ enum { class ColorProfileImpl; -/// The SPColorProfile vtable. +/** + * The SPColorProfile vtable. + */ struct ColorProfileClass { SPObjectClass parent_class; }; -/** Color Profile. */ +/** + * Color Profile. + */ struct ColorProfile : public SPObject { friend cmsHPROFILE colorprofile_get_handle( SPDocument*, guint*, gchar const* ); friend class CMSSystem; @@ -43,7 +43,7 @@ struct ColorProfile : public SPObject { static std::vector<Glib::ustring> getBaseProfileDirs(); static std::vector<Glib::ustring> getProfileFiles(); static std::vector<std::pair<Glib::ustring, Glib::ustring> > getProfileFilesWithNames(); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) //icColorSpaceSignature getColorSpace() const; ColorSpaceSig getColorSpace() const; //icProfileClassSignature getProfileClass() const; @@ -53,7 +53,7 @@ struct ColorProfile : public SPObject { cmsHTRANSFORM getTransfGamutCheck(); bool GamutCheck(SPColor color); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gchar* href; gchar* local; diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp index 7db14737b..449255133 100644 --- a/src/display/nr-filter-flood.cpp +++ b/src/display/nr-filter-flood.cpp @@ -43,7 +43,8 @@ void FilterFlood::render_cairo(FilterSlot &slot) double b = SP_RGBA32_B_F(color); double a = opacity; - #if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) + if (icc) { guchar ru, gu, bu; icc_color_to_sRGB(icc, &ru, &gu, &bu); @@ -51,7 +52,7 @@ void FilterFlood::render_cairo(FilterSlot &slot) g = SP_COLOR_U_TO_F(gu); b = SP_COLOR_U_TO_F(bu); } - #endif +#endif cairo_surface_t *out = ink_cairo_surface_create_same_size(input, CAIRO_CONTENT_COLOR_ALPHA); cairo_t *ct = cairo_create(out); diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 4a3022d84..53d14200a 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1203,10 +1203,10 @@ void SPCanvasImpl::init(SPCanvas *canvas) canvas->forced_redraw_count = 0; canvas->forced_redraw_limit = -1; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) canvas->enable_cms_display_adj = false; new (&canvas->cms_key) Glib::ustring(""); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) canvas->is_scrolling = false; } @@ -1252,7 +1252,7 @@ void SPCanvasImpl::destroy(GtkObject *object) } shutdown_transients(canvas); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) canvas->cms_key.~ustring(); #endif if (GTK_OBJECT_CLASS(parentClass)->destroy) { @@ -1786,7 +1786,7 @@ void SPCanvasImpl::sp_canvas_paint_single_buffer(SPCanvas *canvas, Geom::IntRect // output to X cairo_destroy(buf.ct); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (canvas->enable_cms_display_adj) { cmsHTRANSFORM transf = 0; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1808,7 +1808,7 @@ void SPCanvasImpl::sp_canvas_paint_single_buffer(SPCanvas *canvas, Geom::IntRect cairo_surface_mark_dirty(imgs); } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) cairo_t *xct = gdk_cairo_create(gtk_widget_get_window (widget)); cairo_translate(xct, paint_rect.left() - canvas->x0, paint_rect.top() - canvas->y0); diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 3bdd5c061..f0366a2e5 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -184,10 +184,10 @@ struct SPCanvas { int rendermode; int colorrendermode; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) bool enable_cms_display_adj; Glib::ustring cms_key; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) bool is_scrolling; diff --git a/src/sp-image.cpp b/src/sp-image.cpp index fd5a8037e..df0d052dd 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -44,10 +44,16 @@ #include "snap-candidate.h" #include "io/sys.h" -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "cms-system.h" #include "color-profile.h" -#include <lcms.h> + +#if HAVE_LIBLCMS2 +# include <lcms2.h> +#elif HAVE_LIBLCMS1 +# include <lcms.h> +#endif // HAVE_LIBLCMS2 + //#define DEBUG_LCMS #ifdef DEBUG_LCMS @@ -60,7 +66,7 @@ #include "preferences.h" #include <gtk/gtk.h> #endif // DEBUG_LCMS -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* * SPImage */ @@ -610,9 +616,9 @@ static void sp_image_init( SPImage *image ) image->curve = NULL; image->href = 0; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) image->color_profile = 0; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) image->pixbuf = 0; image->pixPath = 0; image->lastMod = 0; @@ -655,12 +661,12 @@ static void sp_image_release( SPObject *object ) image->pixbuf = NULL; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (image->color_profile) { g_free (image->color_profile); image->color_profile = NULL; } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (image->pixPath) { g_free(image->pixPath); @@ -772,7 +778,7 @@ static void sp_image_set( SPObject *object, unsigned int key, const gchar *value image->aspect_clip = clip; } break; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) case SP_PROP_COLOR_PROFILE: if ( image->color_profile ) { g_free (image->color_profile); @@ -788,7 +794,7 @@ static void sp_image_set( SPObject *object, unsigned int key, const gchar *value // TODO check on this HREF_MODIFIED flag object->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_IMAGE_HREF_MODIFIED_FLAG); break; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) default: if (((SPObjectClass *) (parent_class))->set) ((SPObjectClass *) (parent_class))->set (object, key, value); @@ -832,7 +838,7 @@ static void sp_image_update( SPObject *object, SPCtx *ctx, unsigned int flags ) if (pixbuf) { pixbuf = sp_image_pixbuf_force_rgba (pixbuf); // BLIP -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if ( image->color_profile ) { int imagewidth = gdk_pixbuf_get_width( pixbuf ); @@ -849,8 +855,8 @@ static void sp_image_update( SPObject *object, SPCtx *ctx, unsigned int flags ) &profIntent, image->color_profile ); if ( prof ) { - icProfileClassSignature profileClass = cmsGetDeviceClass( prof ); - if ( profileClass != icSigNamedColorClass ) { + cmsProfileClassSignature profileClass = cmsGetDeviceClass( prof ); + if ( profileClass != cmsSigNamedColorClass ) { int intent = INTENT_PERCEPTUAL; switch ( profIntent ) { case Inkscape::RENDERING_INTENT_RELATIVE_COLORIMETRIC: @@ -907,7 +913,7 @@ static void sp_image_update( SPObject *object, SPCtx *ctx, unsigned int flags ) #endif // DEBUG_LCMS } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) image->pixbuf = pixbuf; // convert to premultiplied native-endian ARGB for display with Cairo convert_pixbuf_normal_to_argb32(image->pixbuf); @@ -1044,11 +1050,11 @@ static Inkscape::XML::Node *sp_image_write( SPObject *object, Inkscape::XML::Doc //XML Tree being used directly here while it shouldn't be... repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (image->color_profile) { repr->setAttribute("color-profile", image->color_profile); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if (((SPObjectClass *) (parent_class))->write) { ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); diff --git a/src/sp-image.h b/src/sp-image.h index 2b3940412..c657d0a2f 100644 --- a/src/sp-image.h +++ b/src/sp-image.h @@ -52,9 +52,9 @@ struct SPImage : public SPItem { SPCurve *curve; // This curve is at the image's boundary for snapping gchar *href; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gchar *color_profile; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) GdkPixbuf *pixbuf; gchar *pixPath; diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index a8dff0bf0..705e2a76f 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -29,13 +29,13 @@ #include "svg-color.h" #include "svg-icc-color.h" -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "color.h" #include "color-profile.h" #include "document.h" #include "inkscape.h" #include "profile-manager.h" -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "cms-system.h" using std::sprintf; @@ -457,7 +457,7 @@ sp_svg_create_color_hash() return colors; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) //helper function borrowed from src/widgets/sp-color-icc-selector.cpp: void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const**& tippies, guint const*& scalies ); @@ -493,7 +493,7 @@ g_message("transform to sRGB done"); } } } -#endif //ENABLE_LCMS +#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* * Some discussion at http://markmail.org/message/bhfvdfptt25kgtmj diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index b52bb4062..fa6ef2726 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -42,9 +42,9 @@ #include "xml/node-event-vector.h" #include "xml/repr.h" -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "color-profile.h" -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include <gtkmm/stock.h> @@ -151,9 +151,9 @@ DocumentProperties::DocumentProperties() build_guides(); build_gridspage(); build_snap(); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) build_cms(); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) build_scripting(); _grids_button_new.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::onNewGrid)); @@ -312,7 +312,7 @@ void DocumentProperties::build_snap() attach_all(_page_snap.table(), array, G_N_ELEMENTS(array)); } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /// Populates the available color profiles combo box void DocumentProperties::populate_available_profiles(){ #if WITH_GTKMM_2_24 @@ -577,7 +577,7 @@ void DocumentProperties::build_cms() } _emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_linked_profiles_box)); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void DocumentProperties::build_scripting() { @@ -702,13 +702,13 @@ void DocumentProperties::build_scripting() _new_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addEmbeddedScript)); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _ExternalScriptsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::external_scripts_list_button_release)); external_create_popup_menu(_ExternalScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); _EmbeddedScriptsList.signal_button_release_event().connect_notify(sigc::mem_fun(*this, &DocumentProperties::embedded_scripts_list_button_release)); embedded_create_popup_menu(_EmbeddedScriptsList, sigc::mem_fun(*this, &DocumentProperties::removeEmbeddedScript)); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) //TODO: review this observers code: const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); @@ -1054,10 +1054,10 @@ void DocumentProperties::update() //------------------------------------------------Color Management page -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) populate_linked_profiles_box(); populate_available_profiles(); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _wr.setUpdating (false); } diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 103ace10b..783dfa208 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -50,21 +50,21 @@ protected: void build_guides(); void build_snap(); void build_gridspage(); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void build_cms(); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void build_scripting(); void init(); virtual void on_response (int); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void populate_available_profiles(); void populate_linked_profiles_box(); void linkSelectedProfile(); void removeSelectedProfile(); void linked_profiles_list_button_release(GdkEventButton* event); void cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void external_scripts_list_button_release(GdkEventButton* event); void embedded_scripts_list_button_release(GdkEventButton* event); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 845316f1a..4ae9d96af 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -689,7 +689,7 @@ void InkscapePreferences::initPageUI() this->AddPage(_page_grids, _("Grids"), iter_ui, PREFS_PAGE_UI_GRIDS); } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) static void profileComboChanged( Gtk::ComboBoxText* combo ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -729,7 +729,7 @@ static void gamutColorChanged( Gtk::ColorButton* btn ) { prefs->setString("/options/softproof/gamutcolor", tmp); g_free(tmp); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void InkscapePreferences::initPageIO() { @@ -833,10 +833,10 @@ void InkscapePreferences::initPageIO() Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")}; int intentValues[numIntents] = {0, 1, 2, 3}; -#if !ENABLE_LCMS +#if !defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) Gtk::Label* lbl = new Gtk::Label(_("(Note: Color management has been disabled in this build)")); _page_cms.add_line( false, "", *lbl, "", "", true); -#endif // !ENABLE_LCMS +#endif // !defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _page_cms.add_group_header( _("Display adjustment")); @@ -908,7 +908,7 @@ void InkscapePreferences::initPageIO() #endif // !defined(cmsFLAGS_PRESERVEBLACK) -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) { std::vector<Glib::ustring> names = ::Inkscape::CMSSystem::getDisplayNames(); Glib::ustring current = prefs->getString( "/options/displayprofile/uri" ); @@ -969,7 +969,7 @@ void InkscapePreferences::initPageIO() _cms_proof_profile.set_sensitive( false ); _cms_proof_blackpoint.set_sensitive( false ); _cms_proof_preserveblack.set_sensitive( false ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) this->AddPage(_page_cms, _("Color management"), iter_io, PREFS_PAGE_IO_CMS); diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index e5058680f..2c41bf2d1 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -105,9 +105,9 @@ static void sp_desktop_widget_realize (GtkWidget *widget); static gint sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw); static void sp_dtw_color_profile_event(EgeColorProfTracker *widget, SPDesktopWidget *dtw); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) static void cms_adjust_toggled( GtkWidget *button, gpointer data ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) static void cms_adjust_set_sensitive( SPDesktopWidget *dtw, bool enabled ); static void sp_desktop_widget_adjustment_value_changed (GtkAdjustment *adj, SPDesktopWidget *dtw); @@ -189,7 +189,7 @@ private: friend class SoftproofWatcher; }; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint screen, gint monitor, CMSPrefWatcher * /*watcher*/) { unsigned char* buf = 0; @@ -202,22 +202,22 @@ void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint screen, gint m void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint /*screen*/, gint /*monitor*/, CMSPrefWatcher * /*watcher*/) { } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /// @todo Use conditional compilation in saner places. The whole PrefWatcher -/// object is unnecessary if ENABLE_LCMS is not defined. +/// object is unnecessary if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) is not defined. void CMSPrefWatcher::_refreshAll() { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) for ( std::list<SPDesktopWidget*>::iterator it = _widget_list.begin(); it != _widget_list.end(); ++it ) { (*it)->requestCanvasUpdate(); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } void CMSPrefWatcher::_setCmsSensitive(bool enabled) { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) for ( std::list<SPDesktopWidget*>::iterator it = _widget_list.begin(); it != _widget_list.end(); ++it ) { SPDesktopWidget *dtw = *it; if ( gtk_widget_get_sensitive( dtw->cms_adjust ) != enabled ) { @@ -226,7 +226,7 @@ void CMSPrefWatcher::_setCmsSensitive(bool enabled) } #else (void) enabled; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } static CMSPrefWatcher* watcher = NULL; @@ -420,7 +420,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) NULL, INKSCAPE_ICON("color-management"), tip ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) { Glib::ustring current = prefs->getString("/options/displayprofile/uri"); bool enabled = current.length() > 0; @@ -435,7 +435,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) g_signal_connect_after( G_OBJECT(dtw->cms_adjust), "clicked", G_CALLBACK(cms_adjust_toggled), dtw ); #else cms_adjust_set_sensitive(dtw, FALSE); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_table_attach( GTK_TABLE(canvas_tbl), dtw->cms_adjust, 2, 3, 2, 3, (GtkAttachOptions)(GTK_SHRINK), (GtkAttachOptions)(GTK_SHRINK), 0, 0); { if (!watcher) { @@ -446,9 +446,9 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) /* Canvas */ dtw->canvas = SP_CANVAS(SPCanvas::createAA()); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) dtw->canvas->enable_cms_display_adj = prefs->getBool("/options/displayprofile/enable"); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_widget_set_can_focus (GTK_WIDGET (dtw->canvas), TRUE); style = gtk_style_copy(gtk_widget_get_style(GTK_WIDGET(dtw->canvas))); style->bg[GTK_STATE_NORMAL] = style->white; @@ -546,7 +546,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) gtk_box_pack_start(GTK_BOX(dtw->statusbar), GTK_WIDGET(dtw->layer_selector->gobj()), FALSE, FALSE, 1); dtw->_tracker = ege_color_prof_tracker_new(GTK_WIDGET(dtw->layer_selector->gobj())); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display"); if ( fromDisplay ) { Glib::ustring id = Inkscape::CMSSystem::getDisplayId( 0, 0 ); @@ -556,7 +556,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) enabled = !dtw->canvas->cms_key.empty(); cms_adjust_set_sensitive( dtw, enabled ); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) g_signal_connect( G_OBJECT(dtw->_tracker), "changed", G_CALLBACK(sp_dtw_color_profile_event), dtw ); dtw->select_status_eventbox = gtk_event_box_new (); @@ -801,7 +801,7 @@ sp_desktop_widget_event (GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dt return FALSE; } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget *dtw) { // Handle profile changes @@ -820,9 +820,9 @@ void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidge void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget * /*dtw*/) { } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void cms_adjust_toggled( GtkWidget */*button*/, gpointer data ) { SPDesktopWidget *dtw = SP_DESKTOP_WIDGET(data); @@ -840,7 +840,7 @@ void cms_adjust_toggled( GtkWidget */*button*/, gpointer data ) } } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void cms_adjust_set_sensitive( SPDesktopWidget *dtw, bool enabled ) { diff --git a/src/widgets/sp-color-icc-selector.cpp b/src/widgets/sp-color-icc-selector.cpp index c9550f244..844ba0020 100644 --- a/src/widgets/sp-color-icc-selector.cpp +++ b/src/widgets/sp-color-icc-selector.cpp @@ -14,7 +14,7 @@ #define noDEBUG_LCMS -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #include "color-profile.h" #include "cms-system.h" #include "color-profile-cms-fns.h" @@ -22,7 +22,7 @@ #ifdef DEBUG_LCMS #include "preferences.h" #endif // DEBUG_LCMS -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) #ifdef DEBUG_LCMS @@ -142,13 +142,13 @@ ColorICCSelector::ColorICCSelector( SPColorSelector* csel ) _slider(0), _sbtn(0), _label(0) -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) , _profileName(""), _prof(), _profChannelCount(0), _profChangedID(0) -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) { } @@ -180,32 +180,32 @@ icSigCmyData #define SPACE_ID_CMYK 2 -#if ENABLE_LCMS -static icUInt16Number* getScratch() { +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +static cmsUInt16Number* getScratch() { // bytes per pixel * input channels * width - static icUInt16Number* scritch = static_cast<icUInt16Number*>(g_new(icUInt16Number, 4 * 1024)); + static cmsUInt16Number* scritch = static_cast<cmsUInt16Number*>(g_new(cmsUInt16Number, 4 * 1024)); return scritch; } struct MapMap { - DWORD space; - DWORD inForm; + cmsUInt32Number space; + cmsUInt32Number inForm; }; -void getThings( DWORD space, gchar const**& namers, gchar const**& tippies, guint const*& scalies ) { +void getThings( cmsUInt32Number space, gchar const**& namers, gchar const**& tippies, guint const*& scalies ) { MapMap possible[] = { - {icSigXYZData, TYPE_XYZ_16}, - {icSigLabData, TYPE_Lab_16}, - //icSigLuvData - {icSigYCbCrData, TYPE_YCbCr_16}, - {icSigYxyData, TYPE_Yxy_16}, - {icSigRgbData, TYPE_RGB_16}, - {icSigGrayData, TYPE_GRAY_16}, - {icSigHsvData, TYPE_HSV_16}, - {icSigHlsData, TYPE_HLS_16}, - {icSigCmykData, TYPE_CMYK_16}, - {icSigCmyData, TYPE_CMY_16}, + {cmsSigXYZData, TYPE_XYZ_16}, + {cmsSigLabData, TYPE_Lab_16}, + //cmsSigLuvData + {cmsSigYCbCrData, TYPE_YCbCr_16}, + {cmsSigYxyData, TYPE_Yxy_16}, + {cmsSigRgbData, TYPE_RGB_16}, + {cmsSigGrayData, TYPE_GRAY_16}, + {cmsSigHsvData, TYPE_HSV_16}, + {cmsSigHlsData, TYPE_HLS_16}, + {cmsSigCmykData, TYPE_CMYK_16}, + {cmsSigCmyData, TYPE_CMY_16}, }; static gchar const *names[][6] = { @@ -268,7 +268,7 @@ void getThings( Inkscape::ColorProfile *prof, gchar const**& namers, gchar const getThings( asICColorSpaceSig(prof->getColorSpace()), namers, tippies, scalies ); } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::init() @@ -283,12 +283,12 @@ void ColorICCSelector::init() gtk_widget_show (t); gtk_box_pack_start (GTK_BOX (_csel), t, TRUE, TRUE, 0); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) //guint partCount = _cmsChannelsOf( icSigRgbData ); gchar const** names = 0; gchar const** tips = 0; - getThings( icSigRgbData, names, tips, _fooScales ); -#endif // ENABLE_LCMS + getThings( cmsSigRgbData, names, tips, _fooScales ); +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create components */ row = 0; @@ -314,11 +314,11 @@ void ColorICCSelector::init() gtk_combo_box_set_active( GTK_COMBO_BOX(_profileSel), 0 ); gtk_table_attach( GTK_TABLE(t), _profileSel, 1, 2, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _profChangedID = g_signal_connect( G_OBJECT(_profileSel), "changed", G_CALLBACK(_profileSelected), (gpointer)this ); #else gtk_widget_set_sensitive( _profileSel, false ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) row++; @@ -332,11 +332,11 @@ void ColorICCSelector::init() for ( guint i = 0; i < _fooCount; i++ ) { /* Label */ -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _fooLabel[i] = gtk_label_new_with_mnemonic( names[i] ); #else _fooLabel[i] = gtk_label_new_with_mnemonic( "." ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_misc_set_alignment( GTK_MISC (_fooLabel[i]), 1.0, 0.5 ); gtk_widget_show( _fooLabel[i] ); gtk_table_attach( GTK_TABLE (t), _fooLabel[i], 0, 1, row, row + 1, GTK_FILL, GTK_FILL, XPAD, YPAD ); @@ -349,20 +349,20 @@ void ColorICCSelector::init() /* Slider */ _fooSlider[i] = sp_color_slider_new( _fooAdj[i] ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_widget_set_tooltip_text( _fooSlider[i], tips[i] ); #else gtk_widget_set_tooltip_text( _fooSlider[i], "." ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_widget_show( _fooSlider[i] ); gtk_table_attach( GTK_TABLE (t), _fooSlider[i], 1, 2, row, row + 1, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL), (GtkAttachOptions)GTK_FILL, XPAD, YPAD ); _fooBtn[i] = gtk_spin_button_new( _fooAdj[i], step, digits ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_widget_set_tooltip_text( _fooBtn[i], tips[i] ); #else gtk_widget_set_tooltip_text( _fooBtn[i], "." ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) sp_dialog_defocus_on_enter( _fooBtn[i] ); gtk_label_set_mnemonic_widget( GTK_LABEL(_fooLabel[i]), _fooBtn[i] ); gtk_widget_show( _fooBtn[i] ); @@ -460,7 +460,7 @@ void ColorICCSelector::_fixupHit( GtkWidget* /*src*/, gpointer data ) self->_adjustmentChanged( self->_fooAdj[0], SP_COLOR_ICC_SELECTOR(self->_csel) ); } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::_profileSelected( GtkWidget* /*src*/, gpointer data ) { ColorICCSelector* self = reinterpret_cast<ColorICCSelector*>(data); @@ -475,9 +475,9 @@ void ColorICCSelector::_profileSelected( GtkWidget* /*src*/, gpointer data ) g_free( name ); } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#ifdef ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::_switchToProfile( gchar const* name ) { bool dirty = false; @@ -511,12 +511,16 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) #ifdef DEBUG_LCMS g_message("Shoving in [%02x] [%02x] [%02x]", pre[0], pre[1], pre[2]); #endif // DEBUG_LCMS - icUInt16Number post[4] = {0,0,0,0}; + cmsUInt16Number post[4] = {0,0,0,0}; cmsDoTransform( trans, pre, post, 1 ); #ifdef DEBUG_LCMS g_message("got on out [%04x] [%04x] [%04x] [%04x]", post[0], post[1], post[2], post[3]); #endif // DEBUG_LCMS +#if HAVE_LIBLCMS1 guint count = _cmsChannelsOf( asICColorSpaceSig(newProf->getColorSpace()) ); +#elif HAVE_LIBLCMS2 + guint count = cmsChannelsOf( asICColorSpaceSig(newProf->getColorSpace()) ); +#endif gchar const** names = 0; gchar const** tips = 0; @@ -571,9 +575,9 @@ void ColorICCSelector::_switchToProfile( gchar const* name ) #endif // DEBUG_LCMS } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) -#ifdef ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::_profilesChanged( std::string const & name ) { GtkComboBox* combo = GTK_COMBO_BOX(_profileSel); @@ -622,7 +626,7 @@ void ColorICCSelector::_profilesChanged( std::string const & name ) void ColorICCSelector::_profilesChanged( std::string const & /*name*/ ) { } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Helpers for setting color value */ @@ -644,13 +648,13 @@ void ColorICCSelector::_colorChanged() _profilesChanged( (_color.icc) ? _color.icc->colorProfile : std::string("") ); ColorScales::setScaled( _adj, _alpha ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _setProfile( _color.icc ); _fixupNeeded = 0; gtk_widget_set_sensitive( _fixupBtn, FALSE ); if ( _prof && _prof->getTransfToSRGB8() ) { - icUInt16Number tmp[4]; + cmsUInt16Number tmp[4]; for ( guint i = 0; i < _profChannelCount; i++ ) { gdouble val = 0.0; if ( _color.icc->colors.size() > i ) { @@ -678,7 +682,7 @@ void ColorICCSelector::_colorChanged() } #else //(void)color; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) _updateSliders( -1 ); @@ -688,7 +692,7 @@ void ColorICCSelector::_colorChanged() #endif // DEBUG_LCMS } -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::_setProfile( SVGICCColor* profile ) { #ifdef DEBUG_LCMS @@ -715,8 +719,12 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) if ( profile ) { _prof = SP_ACTIVE_DOCUMENT->profileManager->find(profile->colorProfile.c_str()); - if ( _prof && (asICColorProfileClassSig(_prof->getProfileClass()) != icSigNamedColorClass) ) { + if ( _prof && (asICColorProfileClassSig(_prof->getProfileClass()) != cmsSigNamedColorClass) ) { +#if HAVE_LIBLCMS1 _profChannelCount = _cmsChannelsOf( asICColorSpaceSig(_prof->getColorSpace()) ); +#elif HAVE_LIBLCMS2 + _profChannelCount = cmsChannelsOf( asICColorSpaceSig(_prof->getColorSpace()) ); +#endif gchar const** names = 0; gchar const** tips = 0; @@ -763,11 +771,11 @@ void ColorICCSelector::_setProfile( SVGICCColor* profile ) g_message( "\\_________ %p::_setProfile()", this ); #endif // DEBUG_LCMS } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void ColorICCSelector::_updateSliders( gint ignore ) { -#ifdef ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if ( _color.icc ) { for ( guint i = 0; i < _profChannelCount; i++ ) { @@ -785,13 +793,13 @@ void ColorICCSelector::_updateSliders( gint ignore ) if ( _prof && _prof->getTransfToSRGB8() ) { for ( guint i = 0; i < _profChannelCount; i++ ) { if ( static_cast<gint>(i) != ignore ) { - icUInt16Number* scratch = getScratch(); - icUInt16Number filler[4] = {0, 0, 0, 0}; + cmsUInt16Number* scratch = getScratch(); + cmsUInt16Number filler[4] = {0, 0, 0, 0}; for ( guint j = 0; j < _profChannelCount; j++ ) { filler[j] = 0x0ffff * ColorScales::getScaled( _fooAdj[j] ); } - icUInt16Number* p = scratch; + cmsUInt16Number* p = scratch; for ( guint x = 0; x < 1024; x++ ) { for ( guint j = 0; j < _profChannelCount; j++ ) { if ( j == i ) { @@ -813,7 +821,7 @@ void ColorICCSelector::_updateSliders( gint ignore ) } #else (void)ignore; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) guint32 start = _color.toRGBA32( 0x00 ); guint32 mid = _color.toRGBA32( 0x7f ); @@ -852,7 +860,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC g_message("ALPHA"); #endif // DEBUG_LCMS } else { -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) for ( guint i = 0; i < iccSelector->_fooCount; i++ ) { if ( iccSelector->_fooAdj[i] == adjustment ) { match = i; @@ -866,7 +874,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC } - icUInt16Number tmp[4]; + cmsUInt16Number tmp[4]; for ( guint i = 0; i < 4; i++ ) { tmp[i] = ColorScales::getScaled( iccSelector->_fooAdj[i] ) * 0x0ffff; } @@ -904,7 +912,7 @@ void ColorICCSelector::_adjustmentChanged( GtkAdjustment *adjustment, SPColorICC newColor.icc->colors.push_back( val ); } } -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) } iccSelector->_updateInternals( newColor, scaled, iccSelector->_dragging ); iccSelector->_updateSliders( match ); diff --git a/src/widgets/sp-color-icc-selector.h b/src/widgets/sp-color-icc-selector.h index 166348830..67fedf590 100644 --- a/src/widgets/sp-color-icc-selector.h +++ b/src/widgets/sp-color-icc-selector.h @@ -37,10 +37,10 @@ protected: static void _profileSelected( GtkWidget* src, gpointer data ); void _recalcColor( gboolean changing ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void _setProfile( SVGICCColor* profile ); void _switchToProfile( gchar const* name ); -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) void _updateSliders( gint ignore ); void _profilesChanged( std::string const & name ); @@ -64,12 +64,12 @@ protected: GtkWidget* _sbtn; /* Spinbutton */ GtkWidget* _label; /* Label */ -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) std::string _profileName; Inkscape::ColorProfile* _prof; guint _profChannelCount; gulong _profChangedID; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) private: // By default, disallow copy constructor and assignment operator diff --git a/src/widgets/sp-color-notebook.cpp b/src/widgets/sp-color-notebook.cpp index 1324e0b16..2fbf6a763 100644 --- a/src/widgets/sp-color-notebook.cpp +++ b/src/widgets/sp-color-notebook.cpp @@ -208,9 +208,9 @@ void ColorNotebook::init() /* tempory hardcoding to get types loaded */ SP_TYPE_COLOR_SCALES; SP_TYPE_COLOR_WHEEL_SELECTOR; -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) SP_TYPE_COLOR_ICC_SELECTOR; -#endif // ENABLE_LCMS +#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* REJON: Comment out the next line to not use the normal GTK Color wheel. */ @@ -331,7 +331,7 @@ void ColorNotebook::init() GtkWidget *rgbabox = gtk_hbox_new (FALSE, 0); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create color management icons */ _box_colormanaged = gtk_event_box_new (); GtkWidget *colormanaged = gtk_image_new_from_icon_name ("color-management-icon", GTK_ICON_SIZE_SMALL_TOOLBAR); @@ -354,7 +354,7 @@ void ColorNotebook::init() gtk_widget_set_sensitive (_box_toomuchink, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_toomuchink, FALSE, FALSE, 2); -#endif //ENABLE_LCMS +#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* Create RGBA entry and color preview */ _rgbal = gtk_label_new_with_mnemonic (_("RGBA_:")); @@ -372,10 +372,10 @@ void ColorNotebook::init() sp_set_font_size_smaller (rgbabox); gtk_widget_show_all (rgbabox); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) //the "too much ink" icon is initially hidden gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); -#endif //ENABLE_LCMS +#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) gtk_table_attach (GTK_TABLE (table), rgbabox, 0, 2, row, row + 1, GTK_FILL, GTK_SHRINK, XPAD, YPAD); @@ -522,7 +522,7 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) { g_return_if_fail( ( 0.0 <= alpha ) && ( alpha <= 1.0 ) ); -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) /* update color management icon*/ gtk_widget_set_sensitive (_box_colormanaged, color.icc != NULL); @@ -554,7 +554,7 @@ void ColorNotebook::_updateRgbaEntry( const SPColor& color, gfloat alpha ) gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); } } -#endif //ENABLE_LCMS +#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) if ( !_updatingrgba ) { diff --git a/src/widgets/sp-color-notebook.h b/src/widgets/sp-color-notebook.h index 85b4315ed..8ea8464a9 100644 --- a/src/widgets/sp-color-notebook.h +++ b/src/widgets/sp-color-notebook.h @@ -59,9 +59,9 @@ protected: gulong _entryId; GtkWidget *_book; GtkWidget *_rgbal, *_rgbae; /* RGBA entry */ -#if ENABLE_LCMS +#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) GtkWidget *_box_outofgamut, *_box_colormanaged, *_box_toomuchink; -#endif //ENABLE_LCMS +#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) GtkWidget *_p; /* Color preview */ GtkWidget *_btn; GtkWidget *_popup; |
