diff options
| author | Karl Cheng <qantas94heavy@gmail.com> | 2019-05-10 07:56:07 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc@jeanmougin.fr> | 2019-05-12 12:45:27 +0000 |
| commit | e6ad8433954db069908bac240f39911fc32e5025 (patch) | |
| tree | e655e16ddc932b6e936ca8ff85626ee5c0fdf023 /src | |
| parent | rename to avoid name clashes. (diff) | |
| download | inkscape-e6ad8433954db069908bac240f39911fc32e5025.tar.gz inkscape-e6ad8433954db069908bac240f39911fc32e5025.zip | |
Remove support for LCMS 1
Now that all platforms (including macOS) now support LCMS 2, we no
longer need to support LCMS 1.
Fixes: https://bugs.launchpad.net/inkscape/+bug/1133014
Diffstat (limited to 'src')
| -rw-r--r-- | src/cms-color-types.h | 31 | ||||
| -rw-r--r-- | src/color-profile-cms-fns.h | 6 | ||||
| -rw-r--r-- | src/display/nr-filter-diffuselighting.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-filter-flood.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-filter-specularlighting.cpp | 2 | ||||
| -rw-r--r-- | src/display/sp-canvas.cpp | 10 | ||||
| -rw-r--r-- | src/display/sp-canvas.h | 4 | ||||
| -rw-r--r-- | src/object/color-profile.cpp | 116 | ||||
| -rw-r--r-- | src/object/color-profile.h | 4 | ||||
| -rw-r--r-- | src/object/sp-image.cpp | 33 | ||||
| -rw-r--r-- | src/object/sp-image.h | 8 | ||||
| -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/ui/widget/color-icc-selector.cpp | 74 | ||||
| -rw-r--r-- | src/ui/widget/color-notebook.cpp | 14 | ||||
| -rw-r--r-- | src/ui/widget/color-notebook.h | 4 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 36 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.h | 2 |
20 files changed, 157 insertions, 239 deletions
diff --git a/src/cms-color-types.h b/src/cms-color-types.h index f312fa686..a4aec7cd2 100644 --- a/src/cms-color-types.h +++ b/src/cms-color-types.h @@ -19,9 +19,6 @@ # include "config.h" // only include where actually required! #endif -#if HAVE_LIBLCMS1 -# include <icc34.h> -#endif #if HAVE_STDINT_H # include <cstdint> // uint8_t, etc @@ -31,34 +28,6 @@ typedef unsigned int guint32; 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 { diff --git a/src/color-profile-cms-fns.h b/src/color-profile-cms-fns.h index 4dd321b22..857ee60eb 100644 --- a/src/color-profile-cms-fns.h +++ b/src/color-profile-cms-fns.h @@ -16,15 +16,13 @@ #if HAVE_LIBLCMS2 # include <lcms2.h> -#elif HAVE_LIBLCMS1 -# include <lcms.h> #endif // HAVE_LIBLCMS2 #include "cms-color-types.h" namespace Inkscape { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) // Note: these can later be adjusted to adapt for lcms2: @@ -47,7 +45,7 @@ public : cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig); cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & sig); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } // namespace Inkscape diff --git a/src/display/nr-filter-diffuselighting.cpp b/src/display/nr-filter-diffuselighting.cpp index cfb8091af..d33d513e6 100644 --- a/src/display/nr-filter-diffuselighting.cpp +++ b/src/display/nr-filter-diffuselighting.cpp @@ -139,7 +139,7 @@ void FilterDiffuseLighting::render_cairo(FilterSlot &slot) double g = SP_RGBA32_G_F(lighting_color); double b = SP_RGBA32_B_F(lighting_color); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (icc) { guchar ru, gu, bu; diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp index eb00d6ea3..05c32939f 100644 --- a/src/display/nr-filter-flood.cpp +++ b/src/display/nr-filter-flood.cpp @@ -44,7 +44,7 @@ void FilterFlood::render_cairo(FilterSlot &slot) double b = SP_RGBA32_B_F(color); double a = opacity; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (icc) { guchar ru, gu, bu; diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp index 54bc50d5f..330f19c36 100644 --- a/src/display/nr-filter-specularlighting.cpp +++ b/src/display/nr-filter-specularlighting.cpp @@ -150,7 +150,7 @@ void FilterSpecularLighting::render_cairo(FilterSlot &slot) double g = SP_RGBA32_G_F(lighting_color); double b = SP_RGBA32_B_F(lighting_color); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (icc) { guchar ru, gu, bu; diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index f3906e24b..e8a36a3a7 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1038,10 +1038,10 @@ static void sp_canvas_init(SPCanvas *canvas) canvas->_changecursor = 0; bool _is_dragging; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) canvas->_enable_cms_display_adj = false; new (&canvas->_cms_key) Glib::ustring(""); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } void SPCanvas::shutdownTransients() @@ -1084,7 +1084,7 @@ void SPCanvas::dispose(GObject *object) } canvas->shutdownTransients(); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) canvas->_cms_key.~ustring(); #endif if (G_OBJECT_CLASS(sp_canvas_parent_class)->dispose) { @@ -1871,7 +1871,7 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect // output to X cairo_destroy(buf.ct); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (_enable_cms_display_adj) { cmsHTRANSFORM transf = nullptr; Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1893,7 +1893,7 @@ void SPCanvas::paintSingleBuffer(Geom::IntRect const &paint_rect, Geom::IntRect cairo_surface_mark_dirty(imgs); } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) cairo_surface_mark_dirty(_backing_store); // cairo_surface_write_to_png( _backing_store, "debug3.png" ); diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h index 9b782e8a4..b4be65887 100644 --- a/src/display/sp-canvas.h +++ b/src/display/sp-canvas.h @@ -269,10 +269,10 @@ public: int _rendermode; int _colorrendermode; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) bool _enable_cms_display_adj; Glib::ustring _cms_key; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) bool _is_scrolling; }; diff --git a/src/object/color-profile.cpp b/src/object/color-profile.cpp index 0e6d5e08d..36bb32142 100644 --- a/src/object/color-profile.cpp +++ b/src/object/color-profile.cpp @@ -38,8 +38,6 @@ #if HAVE_LIBLCMS2 # include <lcms2.h> -#elif HAVE_LIBLCMS1 -# include <lcms.h> #endif // HAVE_LIBLCMS2 #include "xml/repr.h" @@ -64,12 +62,12 @@ using Inkscape::ColorProfileImpl; namespace { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) cmsHPROFILE getSystemProfileHandle(); cmsHPROFILE getProofProfileHandle(); void loadProfiles(); Glib::ustring getNameFromProfile(cmsHPROFILE profile); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } #ifdef DEBUG_LCMS @@ -116,14 +114,14 @@ namespace Inkscape { class ColorProfileImpl { public: -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static cmsHPROFILE _sRGBProf; static cmsHPROFILE _NullProf; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) ColorProfileImpl(); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static cmsUInt32Number _getInputFormat( cmsColorSpaceSignature space ); static cmsHPROFILE getNULLProfile(); @@ -137,10 +135,10 @@ public: cmsHTRANSFORM _transf; cmsHTRANSFORM _revTransf; cmsHTRANSFORM _gamutTransf; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) }; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) cmsColorSpaceSignature asICColorSpaceSig(ColorSpaceSig const & sig) { return ColorSpaceSigWrapper(sig); @@ -150,12 +148,12 @@ cmsProfileClassSignature asICColorProfileClassSig(ColorProfileClassSig const & s { return ColorProfileClassSigWrapper(sig); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } // namespace Inkscape ColorProfileImpl::ColorProfileImpl() -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) : _profHandle(nullptr), _profileClass(cmsSigInputClass), @@ -163,11 +161,11 @@ ColorProfileImpl::ColorProfileImpl() _transf(nullptr), _revTransf(nullptr), _gamutTransf(nullptr) -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) { } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) cmsHPROFILE ColorProfileImpl::_sRGBProf = nullptr; @@ -187,7 +185,7 @@ cmsHPROFILE ColorProfileImpl::getNULLProfile() { return _NullProf; } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) ColorProfile::FilePlusHome::FilePlusHome(Glib::ustring filename, bool isInHome) : filename(std::move(filename)), isInHome(isInHome) { } @@ -265,15 +263,15 @@ void ColorProfile::release() { this->intentStr = nullptr; } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) this->impl->_clearProfile(); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) delete this->impl; this->impl = nullptr; } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void ColorProfileImpl::_clearProfile() { _profileSpace = cmsSigRgbData; @@ -295,7 +293,7 @@ void ColorProfileImpl::_clearProfile() _profHandle = nullptr; } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) /** * Callback: set attributes from associated repr. @@ -334,10 +332,7 @@ void ColorProfile::set(SPAttributeEnum key, gchar const *value) { if ( value ) { this->href = g_strdup( value ); if ( *this->href ) { -#if HAVE_LIBLCMS1 - cmsErrorAction( LCMS_ERROR_SHOW ); -#endif -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) // TODO open filename and URIs properly //FILE* fp = fopen_utf8name( filename, "r" ); @@ -372,7 +367,7 @@ void ColorProfile::set(SPAttributeEnum key, gchar const *value) { this->impl->_profileClass = cmsGetDeviceClass( this->impl->_profHandle ); } DEBUG_MESSAGE( lcmsOne, "cmsOpenProfileFromFile( '%s'...) = %p", fullname, (void*)this->impl->_profHandle ); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } } this->requestModified(SP_OBJECT_MODIFIED_FLAG); @@ -461,7 +456,7 @@ Inkscape::XML::Node* ColorProfile::write(Inkscape::XML::Document *xml_doc, Inksc } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) struct MapMap { cmsColorSpaceSignature space; @@ -599,19 +594,13 @@ bool ColorProfile::GamutCheck(SPColor color) { 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 +#if HAVE_LIBLCMS2 cmsUInt16Number oldAlarmCodes[cmsMAXCHANNELS] = {0}; cmsGetAlarmCodes(oldAlarmCodes); cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; newAlarmCodes[0] = ~0; cmsSetAlarmCodes(newAlarmCodes); -#endif // HAVE_LIBLCMS1 +#endif cmsUInt8Number outofgamut = 0; guchar check_color[4] = { @@ -625,11 +614,9 @@ bool ColorProfile::GamutCheck(SPColor color) cmsDoTransform(gamutCheck, &check_color, &outofgamut, 1); } -#if HAVE_LIBLCMS1 - cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 cmsSetAlarmCodes(oldAlarmCodes); -#endif // HAVE_LIBLCMS1 +#endif return (outofgamut != 0); } @@ -727,29 +714,24 @@ gint Inkscape::CMSSystem::getChannelCount(ColorProfile const *profile) { gint count = 0; if ( profile ) { -#if HAVE_LIBLCMS1 - count = _cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) ); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 count = cmsChannelsOf( asICColorSpaceSig(profile->getColorSpace()) ); #endif } return count; } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) // the bool return value tells if it's a user's directory or a system location // note that this will treat places under $HOME as system directories when they are found via $XDG_DATA_DIRS std::set<ColorProfile::FilePlusHome> ColorProfile::getBaseProfileDirs() { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static bool warnSet = false; if (!warnSet) { -#if HAVE_LIBLCMS1 - cmsErrorAction( LCMS_ERROR_SHOW ); -#endif warnSet = true; } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) std::set<ColorProfile::FilePlusHome> sources; // first try user's local dir @@ -831,7 +813,7 @@ static bool isIccFile( gchar const *filepath ) } close(fd); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (isIccFile) { cmsHPROFILE prof = cmsOpenProfileFromFile( filepath, "r" ); if ( prof ) { @@ -842,7 +824,7 @@ static bool isIccFile( gchar const *filepath ) cmsCloseProfile( prof ); } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } } return isIccFile; @@ -868,7 +850,7 @@ std::set<ColorProfile::FilePlusHomeAndName> ColorProfile::getProfileFilesWithNam { std::set<FilePlusHomeAndName> result; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) for (auto &profile: getProfileFiles()) { cmsHPROFILE hProfile = cmsOpenProfileFromFile(profile.filename.c_str(), "r"); if ( hProfile ) { @@ -877,20 +859,13 @@ std::set<ColorProfile::FilePlusHomeAndName> ColorProfile::getProfileFilesWithNam cmsCloseProfile(hProfile); } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) return result; } -#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 +#if defined(HAVE_LIBLCMS2) +#if HAVE_LIBLCMS2 void errorHandlerCB(cmsContext /*contextID*/, cmsUInt32Number errorCode, char const *errorText) { g_message("lcms: Error %d", errorCode); @@ -906,16 +881,7 @@ Glib::ustring getNameFromProfile(cmsHPROFILE profile) { Glib::ustring nameStr; if ( 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 : C_("Profile name", "None"); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 cmsUInt32Number byteLen = cmsGetProfileInfo(profile, cmsInfoDescription, "en", "US", nullptr, 0); if (byteLen > 0) { // TODO investigate wchar_t and cmsGetProfileInfo() @@ -944,9 +910,7 @@ void loadProfiles() { static bool error_handler_set = false; if (!error_handler_set) { -#if HAVE_LIBLCMS1 - cmsSetErrorHandler(errorHandlerCB); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 //cmsSetLogErrorHandler(errorHandlerCB); //g_message("LCMS error handler set"); #endif @@ -1166,9 +1130,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayTransform() auto gamutColor_g = gamutColor.get_green_u(); auto gamutColor_b = gamutColor.get_blue_u(); -#if HAVE_LIBLCMS1 - cmsSetAlarmCodes(gamutColor_r >> 8, gamutColor_g >> 8, gamutColor_b >> 8); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; newAlarmCodes[0] = gamutColor_r; newAlarmCodes[1] = gamutColor_g; @@ -1328,9 +1290,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) auto gamutColor_g = gamutColor.get_green_u(); auto gamutColor_b = gamutColor.get_blue_u(); -#if HAVE_LIBLCMS1 - cmsSetAlarmCodes(gamutColor_r >> 8, gamutColor_g >> 8, gamutColor_b >> 8); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 cmsUInt16Number newAlarmCodes[cmsMAXCHANNELS] = {0}; newAlarmCodes[0] = gamutColor_r; newAlarmCodes[1] = gamutColor_g; @@ -1363,7 +1323,7 @@ cmsHTRANSFORM Inkscape::CMSSystem::getDisplayPer( Glib::ustring const& id ) -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) /* Local Variables: diff --git a/src/object/color-profile.h b/src/object/color-profile.h index a0b320b02..5120b92fc 100644 --- a/src/object/color-profile.h +++ b/src/object/color-profile.h @@ -74,7 +74,7 @@ public: static std::set<FilePlusHome> getBaseProfileDirs(); static std::set<FilePlusHome> getProfileFiles(); static std::set<FilePlusHomeAndName> getProfileFilesWithNames(); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) //icColorSpaceSignature getColorSpace() const; ColorSpaceSig getColorSpace() const; //icProfileClassSignature getProfileClass() const; @@ -84,7 +84,7 @@ public: cmsHTRANSFORM getTransfGamutCheck(); bool GamutCheck(SPColor color); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) char* href; char* local; diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp index 6c3854cb4..03f42c904 100644 --- a/src/object/sp-image.cpp +++ b/src/object/sp-image.cpp @@ -41,15 +41,10 @@ #include "preferences.h" #include "io/sys.h" -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) #include "cms-system.h" #include "color-profile.h" - -#if HAVE_LIBLCMS2 -# include <lcms2.h> -#elif HAVE_LIBLCMS1 -# include <lcms.h> -#endif // HAVE_LIBLCMS2 +#include <lcms2.h> //#define DEBUG_LCMS #ifdef DEBUG_LCMS @@ -61,7 +56,7 @@ #else #define DEBUG_MESSAGE(key, ...) #endif // DEBUG_LCMS -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) /* * SPImage */ @@ -125,9 +120,9 @@ SPImage::SPImage() : SPItem(), SPViewBox() { this->curve = nullptr; this->href = nullptr; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) this->color_profile = nullptr; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) this->pixbuf = nullptr; } @@ -163,12 +158,12 @@ void SPImage::release() { delete this->pixbuf; this->pixbuf = nullptr; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (this->color_profile) { g_free (this->color_profile); this->color_profile = nullptr; } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) if (this->curve) { this->curve = this->curve->unref(); @@ -230,7 +225,7 @@ void SPImage::set(SPAttributeEnum key, const gchar* value) { this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG); break; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) case SP_PROP_COLOR_PROFILE: if ( this->color_profile ) { g_free (this->color_profile); @@ -248,7 +243,7 @@ void SPImage::set(SPAttributeEnum key, const gchar* value) { this->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG | SP_IMAGE_HREF_MODIFIED_FLAG); break; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) default: SPItem::set(key, value); @@ -259,7 +254,7 @@ void SPImage::set(SPAttributeEnum key, const gchar* value) { } // BLIP -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void SPImage::apply_profile(Inkscape::Pixbuf *pixbuf) { // TODO: this will prevent using MIME data when exporting. @@ -327,7 +322,7 @@ void SPImage::apply_profile(Inkscape::Pixbuf *pixbuf) { } } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void SPImage::update(SPCtx *ctx, unsigned int flags) { @@ -348,7 +343,7 @@ void SPImage::update(SPCtx *ctx, unsigned int flags) { this->getRepr()->attribute("sodipodi:absref"), doc->getDocumentBase(), svgdpi); if (pixbuf) { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if ( this->color_profile ) apply_profile( pixbuf ); #endif this->pixbuf = pixbuf; @@ -481,11 +476,11 @@ Inkscape::XML::Node *SPImage::write(Inkscape::XML::Document *xml_doc, Inkscape:: repr->setAttribute("inkscape:svg-dpi", this->getRepr()->attribute("inkscape:svg-dpi")); //XML Tree being used directly here while it shouldn't be... repr->setAttribute("preserveAspectRatio", this->getRepr()->attribute("preserveAspectRatio")); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (this->color_profile) { repr->setAttribute("color-profile", this->color_profile); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) SPItem::write(xml_doc, repr, flags); diff --git a/src/object/sp-image.h b/src/object/sp-image.h index 2bc5e49a2..d591a499e 100644 --- a/src/object/sp-image.h +++ b/src/object/sp-image.h @@ -46,9 +46,9 @@ public: SPCurve *curve; // This curve is at the image's boundary for snapping char *href; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) char *color_profile; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) Inkscape::Pixbuf *pixbuf; @@ -67,9 +67,9 @@ public: void snappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs) const override; Geom::Affine set_transform(Geom::Affine const &transform) override; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void apply_profile(Inkscape::Pixbuf *pixbuf); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) SPCurve *get_curve () const; void refresh_if_outdated(); diff --git a/src/svg/svg-color.cpp b/src/svg/svg-color.cpp index dbd32b706..1c8c021d3 100644 --- a/src/svg/svg-color.cpp +++ b/src/svg/svg-color.cpp @@ -33,7 +33,7 @@ #include "svg-icc-color.h" #include "color.h" -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) #include <vector> #include "object/color-profile.h" @@ -41,7 +41,7 @@ #include "document.h" #include "inkscape.h" #include "profile-manager.h" -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) #include "cms-system.h" @@ -508,7 +508,7 @@ sp_svg_create_color_hash() return colors; } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void icc_color_to_sRGB(SVGICCColor* icc, guchar* r, guchar* g, guchar* b) { @@ -538,7 +538,7 @@ g_message("transform to sRGB done"); } } } -#endif //defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif //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 9e212b193..1246a2f89 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -44,9 +44,9 @@ #include "ui/widget/notebook-page.h" #include "xml/node-event-vector.h" -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) #include "object/color-profile.h" -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) namespace Inkscape { namespace UI { @@ -160,9 +160,9 @@ DocumentProperties::DocumentProperties() build_guides(); build_gridspage(); build_snap(); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) build_cms(); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) build_scripting(); build_metadata(); _wr.setUpdating (false); @@ -429,7 +429,7 @@ void DocumentProperties::delete_all_guides() } } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) /// Populates the available color profiles combo box void DocumentProperties::populate_available_profiles(){ _AvailableProfilesListStore->clear(); // Clear any existing items in the combo box @@ -791,7 +791,7 @@ void DocumentProperties::build_cms() _emb_profiles_observer.signal_changed().connect(sigc::mem_fun(*this, &DocumentProperties::populate_linked_profiles_box)); onColorProfileSelectRow(); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void DocumentProperties::build_scripting() { @@ -960,7 +960,7 @@ void DocumentProperties::build_scripting() _embed_new_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::addEmbeddedScript)); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) _external_remove_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeExternalScript)); _embed_remove_btn.signal_clicked().connect(sigc::mem_fun(*this, &DocumentProperties::removeEmbeddedScript)); @@ -970,7 +970,7 @@ void DocumentProperties::build_scripting() _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 // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) //TODO: review this observers code: std::vector<SPObject *> current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); @@ -1473,10 +1473,10 @@ void DocumentProperties::update() //------------------------------------------------Color Management page -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) populate_linked_profiles_box(); populate_available_profiles(); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) //-----------------------------------------------------------meta pages /* update the RDF entities */ diff --git a/src/ui/dialog/document-properties.h b/src/ui/dialog/document-properties.h index 1d365f555..8b4e08832 100644 --- a/src/ui/dialog/document-properties.h +++ b/src/ui/dialog/document-properties.h @@ -66,15 +66,15 @@ protected: void create_guides_around_page(); void delete_all_guides(); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void build_cms(); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void build_scripting(); void build_metadata(); void init(); virtual void on_response (int); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void populate_available_profiles(); void populate_linked_profiles_box(); void linkSelectedProfile(); @@ -82,7 +82,7 @@ protected: void onColorProfileSelectRow(); void linked_profiles_list_button_release(GdkEventButton* event); void cms_create_popup_menu(Gtk::Widget& parent, sigc::slot<void> rem); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // 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 0c89a2257..d901c1f1c 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -1218,7 +1218,7 @@ void InkscapePreferences::initPageUI() initKeyboardShortcuts(iter_ui); } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static void profileComboChanged( Gtk::ComboBoxText* combo ) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); @@ -1258,7 +1258,7 @@ static void gamutColorChanged( Gtk::ColorButton* btn ) { prefs->setString("/options/softproof/gamutcolor", tmp); g_free(tmp); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void InkscapePreferences::initPageIO() { @@ -1396,10 +1396,10 @@ void InkscapePreferences::initPageIO() Glib::ustring intentLabels[numIntents] = {_("Perceptual"), _("Relative Colorimetric"), _("Saturation"), _("Absolute Colorimetric")}; int intentValues[numIntents] = {0, 1, 2, 3}; -#if !defined(HAVE_LIBLCMS1) && !defined(HAVE_LIBLCMS2) +#if !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 // !defined(HAVE_LIBLCMS1) && !defined(HAVE_LIBLCMS2) +#endif // !defined(HAVE_LIBLCMS2) _page_cms.add_group_header( _("Display adjustment")); @@ -1475,7 +1475,7 @@ void InkscapePreferences::initPageIO() #endif // !defined(cmsFLAGS_PRESERVEBLACK) -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) { std::vector<Glib::ustring> names = ::Inkscape::CMSSystem::getDisplayNames(); Glib::ustring current = prefs->getString( "/options/displayprofile/uri" ); @@ -1524,7 +1524,7 @@ void InkscapePreferences::initPageIO() _cms_proof_profile.set_sensitive( false ); _cms_proof_blackpoint.set_sensitive( false ); _cms_proof_preserveblack.set_sensitive( false ); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) this->AddPage(_page_cms, _("Color management"), iter_io, PREFS_PAGE_IO_CMS); diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp index a8e1d255f..27c4b4bea 100644 --- a/src/ui/widget/color-icc-selector.cpp +++ b/src/ui/widget/color-icc-selector.cpp @@ -32,7 +32,7 @@ #define noDEBUG_LCMS -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) #include "object/color-profile.h" #include "cms-system.h" #include "color-profile-cms-fns.h" @@ -40,7 +40,7 @@ #ifdef DEBUG_LCMS #include "preferences.h" #endif // DEBUG_LCMS -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) #ifdef DEBUG_LCMS extern guint update_in_progress; @@ -71,7 +71,7 @@ namespace { size_t maxColorspaceComponentCount = 0; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) /** * Internal variable to track all known colorspaces. @@ -132,7 +132,7 @@ colorspace::Component::Component(std::string name, std::string tip, guint scale) { } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static cmsUInt16Number *getScratch() { // bytes per pixel * input channels * width @@ -206,7 +206,7 @@ std::vector<colorspace::Component> colorspace::getColorSpaceInfo(Inkscape::Color return getColorSpaceInfo(asICColorSpaceSig(prof->getColorSpace())); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) namespace Inkscape { namespace UI { @@ -263,7 +263,7 @@ class ColorICCSelectorImpl { static void _profileSelected(GtkWidget *src, gpointer data); static void _fixupHit(GtkWidget *src, gpointer data); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void _setProfile(SVGICCColor *profile); void _switchToProfile(gchar const *name); #endif @@ -287,12 +287,12 @@ class ColorICCSelectorImpl { GtkWidget *_sbtn; // Spinbutton GtkWidget *_label; // Label -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) std::string _profileName; Inkscape::ColorProfile *_prof; guint _profChannelCount; gulong _profChangedID; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) }; @@ -331,12 +331,12 @@ ColorICCSelectorImpl::ColorICCSelectorImpl(ColorICCSelector *owner, SelectedColo , _slider(nullptr) , _sbtn(nullptr) , _label(nullptr) -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) , _profileName() , _prof(nullptr) , _profChannelCount(0) , _profChangedID(0) -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) { } @@ -388,23 +388,23 @@ void ColorICCSelector::init() attachToGridOrTable(t, _impl->_profileSel, 1, row, 1, 1); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) _impl->_profChangedID = g_signal_connect(G_OBJECT(_impl->_profileSel), "changed", G_CALLBACK(ColorICCSelectorImpl::_profileSelected), (gpointer)_impl); #else gtk_widget_set_sensitive(_impl->_profileSel, false); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) row++; // populate the data for colorspaces and channels: -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) std::vector<colorspace::Component> things = colorspace::getColorSpaceInfo(cmsSigRgbData); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) for (size_t i = 0; i < maxColorspaceComponentCount; i++) { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (i < things.size()) { _impl->_compUI.emplace_back(things[i]); } @@ -437,22 +437,22 @@ void ColorICCSelector::init() // Slider _impl->_compUI[i]._slider = Gtk::manage(new Inkscape::UI::Widget::ColorSlider(Glib::wrap(_impl->_compUI[i]._adj, true))); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) _impl->_compUI[i]._slider->set_tooltip_text((i < things.size()) ? things[i].tip.c_str() : ""); #else _impl->_compUI[i]._slider->set_tooltip_text("."); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) _impl->_compUI[i]._slider->show(); _impl->_compUI[i]._slider->set_no_show_all(); attachToGridOrTable(t, _impl->_compUI[i]._slider->gobj(), 1, row, 1, 1, true); _impl->_compUI[i]._btn = gtk_spin_button_new(_impl->_compUI[i]._adj, step, digits); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) gtk_widget_set_tooltip_text(_impl->_compUI[i]._btn, (i < things.size()) ? things[i].tip.c_str() : ""); #else gtk_widget_set_tooltip_text(_impl->_compUI[i]._btn, "."); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) sp_dialog_defocus_on_enter(_impl->_compUI[i]._btn); gtk_label_set_mnemonic_widget(GTK_LABEL(_impl->_compUI[i]._label), _impl->_compUI[i]._btn); gtk_widget_show(_impl->_compUI[i]._btn); @@ -526,7 +526,7 @@ void ColorICCSelectorImpl::_fixupHit(GtkWidget * /*src*/, gpointer data) self->_adjustmentChanged(self->_compUI[0]._adj, self); } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void ColorICCSelectorImpl::_profileSelected(GtkWidget * /*src*/, gpointer data) { ColorICCSelectorImpl *self = reinterpret_cast<ColorICCSelectorImpl *>(data); @@ -545,9 +545,9 @@ void ColorICCSelectorImpl::_profileSelected(GtkWidget * /*src*/, gpointer data) } } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void ColorICCSelectorImpl::_switchToProfile(gchar const *name) { bool dirty = false; @@ -588,9 +588,7 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #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 +#if HAVE_LIBLCMS2 guint count = cmsChannelsOf(asICColorSpaceSig(newProf->getColorSpace())); #endif @@ -649,9 +647,9 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name) #endif // DEBUG_LCMS } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) struct _cmp { bool operator()(const SPObject * const & a, const SPObject * const & b) { @@ -711,7 +709,7 @@ void ColorICCSelectorImpl::_profilesChanged(std::string const &name) } #else void ColorICCSelectorImpl::_profilesChanged(std::string const & /*name*/) {} -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void ColorICCSelector::on_show() { @@ -739,7 +737,7 @@ void ColorICCSelector::_colorChanged() _impl->_profilesChanged((_impl->_color.color().icc) ? _impl->_color.color().icc->colorProfile : std::string("")); ColorScales::setScaled(_impl->_adj, _impl->_color.alpha()); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) _impl->_setProfile(_impl->_color.color().icc); _impl->_fixupNeeded = 0; gtk_widget_set_sensitive(_impl->_fixupBtn, FALSE); @@ -778,7 +776,7 @@ void ColorICCSelector::_colorChanged() } #else //(void)color; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) _impl->_updateSliders(-1); @@ -788,7 +786,7 @@ void ColorICCSelector::_colorChanged() #endif // DEBUG_LCMS } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) { #ifdef DEBUG_LCMS @@ -815,9 +813,7 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) if (profile) { _prof = SP_ACTIVE_DOCUMENT->getProfileManager()->find(profile->colorProfile.c_str()); if (_prof && (asICColorProfileClassSig(_prof->getProfileClass()) != cmsSigNamedColorClass)) { -#if HAVE_LIBLCMS1 - _profChannelCount = _cmsChannelsOf(asICColorSpaceSig(_prof->getColorSpace())); -#elif HAVE_LIBLCMS2 +#if HAVE_LIBLCMS2 _profChannelCount = cmsChannelsOf(asICColorSpaceSig(_prof->getColorSpace())); #endif @@ -873,11 +869,11 @@ void ColorICCSelectorImpl::_setProfile(SVGICCColor *profile) g_message("\\_________ %p::_setProfile()", this); #endif // DEBUG_LCMS } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void ColorICCSelectorImpl::_updateSliders(gint ignore) { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) if (_color.color().icc) { for (guint i = 0; i < _profChannelCount; i++) { gdouble val = 0.0; @@ -929,7 +925,7 @@ void ColorICCSelectorImpl::_updateSliders(gint ignore) } #else (void)ignore; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) guint32 start = _color.color().toRGBA32(0x00); guint32 mid = _color.color().toRGBA32(0x7f); @@ -962,7 +958,7 @@ void ColorICCSelectorImpl::_adjustmentChanged(GtkAdjustment *adjustment, ColorIC #endif // DEBUG_LCMS } else { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) for (size_t i = 0; i < iccSelector->_impl->_compUI.size(); i++) { if (iccSelector->_impl->_compUI[i]._adj == adjustment) { match = i; @@ -1012,7 +1008,7 @@ void ColorICCSelectorImpl::_adjustmentChanged(GtkAdjustment *adjustment, ColorIC newColor.icc->colors.push_back(val); } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } iccSelector->_impl->_color.setColorAlpha(newColor, scaled); // iccSelector->_updateInternals( newColor, scaled, iccSelector->_impl->_dragging ); diff --git a/src/ui/widget/color-notebook.cpp b/src/ui/widget/color-notebook.cpp index 963e5093d..67347d8a4 100644 --- a/src/ui/widget/color-notebook.cpp +++ b/src/ui/widget/color-notebook.cpp @@ -73,7 +73,7 @@ ColorNotebook::ColorNotebook(SelectedColor &color) _available_pages.push_back(page); page = new Page(new ColorWheelSelectorFactory, true); _available_pages.push_back(page); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) page = new Page(new ColorICCSelectorFactory, true); _available_pages.push_back(page); #endif @@ -156,7 +156,7 @@ void ColorNotebook::_initUI() GtkWidget *rgbabox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) /* Create color management icons */ _box_colormanaged = gtk_event_box_new(); GtkWidget *colormanaged = sp_get_icon_image("color-management", GTK_ICON_SIZE_SMALL_TOOLBAR); @@ -178,7 +178,7 @@ void ColorNotebook::_initUI() gtk_widget_set_tooltip_text(_box_toomuchink, _("Too much ink!")); gtk_widget_set_sensitive(_box_toomuchink, false); gtk_box_pack_start(GTK_BOX(rgbabox), _box_toomuchink, FALSE, FALSE, 2); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) /* Color picker */ @@ -203,10 +203,10 @@ void ColorNotebook::_initUI() sp_set_font_size_smaller(rgbabox); gtk_widget_show_all(rgbabox); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) // the "too much ink" icon is initially hidden gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) #if GTK_CHECK_VERSION(3, 12, 0) gtk_widget_set_margin_start(rgbabox, XPAD); @@ -269,7 +269,7 @@ void ColorNotebook::_updateICCButtons() g_return_if_fail((0.0 <= alpha) && (alpha <= 1.0)); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) /* update color management icon*/ gtk_widget_set_sensitive(_box_colormanaged, color.icc != nullptr); @@ -305,7 +305,7 @@ void ColorNotebook::_updateICCButtons() gtk_widget_hide(GTK_WIDGET(_box_toomuchink)); } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } void ColorNotebook::_setCurrentPage(int i) diff --git a/src/ui/widget/color-notebook.h b/src/ui/widget/color-notebook.h index ddc8ea85f..c7bc7b56b 100644 --- a/src/ui/widget/color-notebook.h +++ b/src/ui/widget/color-notebook.h @@ -60,9 +60,9 @@ protected: GtkWidget *_buttonbox; GtkWidget **_buttons; GtkWidget *_rgbal; /* RGBA entry */ -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) GtkWidget *_box_outofgamut, *_box_colormanaged, *_box_toomuchink; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) GtkWidget *_btn_picker; GtkWidget *_p; /* Color preview */ boost::ptr_vector<Page> _available_pages; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index a50427c09..40bada366 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -165,7 +165,7 @@ private: friend class SoftproofWatcher; }; -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint monitor, CMSPrefWatcher * /*watcher*/) { unsigned char* buf = nullptr; @@ -178,22 +178,22 @@ void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint monitor, CMSPr void CMSPrefWatcher::hook(EgeColorProfTracker * /*tracker*/, gint /*monitor*/, CMSPrefWatcher * /*watcher*/) { } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) /// @todo Use conditional compilation in saner places. The whole PrefWatcher -/// object is unnecessary if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) is not defined. +/// object is unnecessary if defined(HAVE_LIBLCMS2) is not defined. void CMSPrefWatcher::_refreshAll() { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) for (auto & it : _widget_list) { it->requestCanvasUpdate(); } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } void CMSPrefWatcher::_setCmsSensitive(bool enabled) { -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) for ( auto dtw : _widget_list ) { auto cms_adj = dtw->get_cms_adjust(); if ( cms_adj->get_sensitive() != enabled ) { @@ -202,7 +202,7 @@ void CMSPrefWatcher::_setCmsSensitive(bool enabled) } #else (void) enabled; -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) } static CMSPrefWatcher* watcher = nullptr; @@ -455,7 +455,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) tip )); dtw->_cms_adjust->set_name("CMS_Adjust"); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) { Glib::ustring current = prefs->getString("/options/displayprofile/uri"); bool enabled = current.length() > 0; @@ -470,7 +470,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) g_signal_connect_after( G_OBJECT(dtw->_cms_adjust->gobj()), "clicked", G_CALLBACK(SPDesktopWidget::cms_adjust_toggled), dtw ); #else dtw->cms_adjust_set_sensitive(false); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) dtw->_canvas_tbl->attach(*dtw->_cms_adjust, 2, 2, 1, 1); { @@ -481,9 +481,9 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) } /* Canvas */ dtw->_canvas = SP_CANVAS(SPCanvas::createAA()); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) dtw->_canvas->_enable_cms_display_adj = prefs->getBool("/options/displayprofile/enable"); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) gtk_widget_set_can_focus (GTK_WIDGET (dtw->_canvas), TRUE); sp_ruler_add_track_widget(SP_RULER(dtw->_hruler->gobj()), GTK_WIDGET(dtw->_canvas)); @@ -667,7 +667,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) // --------------- Color Management ---------------- // dtw->_tracker = ege_color_prof_tracker_new(GTK_WIDGET(dtw->layer_selector->gobj())); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) bool fromDisplay = prefs->getBool( "/options/displayprofile/from_display"); if ( fromDisplay ) { Glib::ustring id = Inkscape::CMSSystem::getDisplayId( 0 ); @@ -678,7 +678,7 @@ void SPDesktopWidget::init( SPDesktopWidget *dtw ) dtw->cms_adjust_set_sensitive(enabled); } g_signal_connect( G_OBJECT(dtw->_tracker), "changed", G_CALLBACK(SPDesktopWidget::color_profile_event), dtw ); -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) // ------------------ Finish Up -------------------- // dtw->_vbox->show_all(); @@ -982,7 +982,7 @@ SPDesktopWidget::event(GtkWidget *widget, GdkEvent *event, SPDesktopWidget *dtw) } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void SPDesktopWidget::color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget *dtw) { @@ -1016,11 +1016,11 @@ SPDesktopWidget::color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktop enabled = !dtw->_canvas->_cms_key.empty(); dtw->cms_adjust_set_sensitive(enabled); } -#else // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#else // defined(HAVE_LIBLCMS2) void sp_dtw_color_profile_event(EgeColorProfTracker */*tracker*/, SPDesktopWidget * /*dtw*/) { } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void SPDesktopWidget::update_guides_lock() @@ -1042,7 +1042,7 @@ SPDesktopWidget::update_guides_lock() } } -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) void SPDesktopWidget::cms_adjust_toggled( GtkWidget */*button*/, gpointer data ) { @@ -1061,7 +1061,7 @@ SPDesktopWidget::cms_adjust_toggled( GtkWidget */*button*/, gpointer data ) } } } -#endif // defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#endif // defined(HAVE_LIBLCMS2) void SPDesktopWidget::cms_adjust_set_sensitive(bool enabled) diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 141d6b057..f0b42222d 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -321,7 +321,7 @@ public: void rotation_populate_popup(Gtk::Menu *menu); void canvas_tbl_size_allocate(Gtk::Allocation &allocation); -#if defined(HAVE_LIBLCMS1) || defined(HAVE_LIBLCMS2) +#if defined(HAVE_LIBLCMS2) static void cms_adjust_toggled( GtkWidget *button, gpointer data ); static void color_profile_event(EgeColorProfTracker *tracker, SPDesktopWidget *dtw); #endif |
