From dc44212691faec0bc73cca2e08f7c7d0ffaf38d7 Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sat, 3 Feb 2018 21:49:41 +0100 Subject: [PATCH] Soft-proofing: fall back to using the current output profile if no printer profile is specified Implements #4361 --- rtdata/languages/default | 4 ++-- rtengine/iccstore.cc | 4 ++++ rtengine/improcfun.cc | 20 ++++++++++++++------ rtgui/editorpanel.cc | 22 +++------------------- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/rtdata/languages/default b/rtdata/languages/default index fff7c3b34..df0cc9dc6 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -1229,8 +1229,8 @@ SAVEDLG_SUBSAMP_TOOLTIP;Best compression:\nJ:a:b 4:2:0\nh/v 2/2\nChroma halved h SAVEDLG_TIFFUNCOMPRESSED;Uncompressed TIFF SAVEDLG_WARNFILENAME;File will be named SHCSELECTOR_TOOLTIP;Click right mouse button to reset the position of those 3 sliders. -SOFTPROOF_GAMUTCHECK_TOOLTIP;If active, indicates in grey the pixels which have out of gamut colors from the Printer profile. -SOFTPROOF_TOOLTIP;Soft-proofing\nIf active, let you simulate the printer's output by using the Printer profile set in Preferences > Color Management. +SOFTPROOF_GAMUTCHECK_TOOLTIP;If active, indicates in bright green the pixels which have out of gamut colors from the Printer/Output profile. +SOFTPROOF_TOOLTIP;Soft-proofing\nIf active, lets you simulate the appearance of the image when printed (if a Printer profile set in Preferences > Color Management) or when viewed on a display that uses the current output profile (if no printer profile is selected). THRESHOLDSELECTOR_B;Bottom THRESHOLDSELECTOR_BL;Bottom-left THRESHOLDSELECTOR_BR;Bottom-right diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 81d0583ac..b8063f54b 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -333,6 +333,10 @@ public: } defaultMonitorProfile = settings->monitorProfile; + + // initialize the alarm colours for lcms gamut checking -- we use bright green + cmsUInt16Number cms_alarm_codes[cmsMAXCHANNELS] = { 0, 65535, 0 }; + cmsSetAlarmCodes(cms_alarm_codes); } cmsHPROFILE workingSpace(const Glib::ustring& name) const diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 37a3e707f..0954867f1 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -300,18 +300,26 @@ void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile, if (softProof) { cmsHPROFILE oprof = nullptr; + RenderingIntent outIntent; + + flags = cmsFLAGS_SOFTPROOFING | cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE; if (!settings->printerProfile.empty()) { oprof = ICCStore::getInstance()->getProfile (settings->printerProfile); + if (settings->printerBPC) { + flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + } + outIntent = settings->printerIntent; + } else { + oprof = ICCStore::getInstance()->getProfile(params->icm.output); + if (params->icm.outputBPC) { + flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; + } + outIntent = params->icm.outputIntent; } if (oprof) { // NOCACHE is for thread safety, NOOPTIMIZE for precision - flags = cmsFLAGS_SOFTPROOFING | cmsFLAGS_NOOPTIMIZE | cmsFLAGS_NOCACHE; - - if (settings->printerBPC) { - flags |= cmsFLAGS_BLACKPOINTCOMPENSATION; - } if (gamutCheck) { flags |= cmsFLAGS_GAMUTCHECK; @@ -321,7 +329,7 @@ void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile, iprof, TYPE_Lab_FLT, monitor, TYPE_RGB_8, oprof, - monitorIntent, settings->printerIntent, + monitorIntent, outIntent, flags ); diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 21753bcf5..b5af09d7b 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -153,7 +153,6 @@ private: Gtk::ToggleButton softProof; Gtk::ToggleButton spGamutCheck; sigc::connection profileConn, intentConn, softproofConn; - bool canSProof; Glib::ustring defprof; rtengine::StagedImageProcessor* const& processor; @@ -212,7 +211,6 @@ private: softProof.set_tooltip_markup (M ("SOFTPROOF_TOOLTIP")); softProof.set_active (false); - softProof.set_sensitive (canSProof); softProof.show (); Gtk::Image *spGamutCheckImage = Gtk::manage (new RTImage ("spGamutCheck.png")); @@ -301,8 +299,8 @@ private: intentBox.setItemSensitivity (0, supportsPerceptual); intentBox.setItemSensitivity (1, supportsRelativeColorimetric); intentBox.setItemSensitivity (2, supportsAbsoluteColorimetric); - softProof.set_sensitive (canSProof); - spGamutCheck.set_sensitive (canSProof); + softProof.set_sensitive (true); + spGamutCheck.set_sensitive (softProof.get_active()); } else { intentBox.setItemSensitivity (0, true); intentBox.setItemSensitivity (1, true); @@ -352,15 +350,9 @@ private: void updateSoftProofParameters (bool noEvent = false) { - if (!canSProof) { - ConnectionBlocker profileBlocker (softproofConn); - softProof.set_active (false); - softProof.set_sensitive (false); #if !defined(__APPLE__) // monitor profile not supported on apple - } else { - softProof.set_sensitive (profileBox.get_active_row_number () > 0); + softProof.set_sensitive (profileBox.get_active_row_number () > 0); #endif - } spGamutCheck.set_sensitive (softProof.get_sensitive() && softProof.get_active()); @@ -390,7 +382,6 @@ private: public: explicit ColorManagementToolbar (rtengine::StagedImageProcessor* const& ipc) : intentBox (Glib::ustring (), true), - canSProof (!options.rtSettings.printerProfile.empty() && options.rtSettings.printerProfile != "None"), // assuming the printer profile exist! processor (ipc) { #if !defined(__APPLE__) // monitor profile not supported on apple @@ -419,12 +410,6 @@ public: grid->attach_next_to (spGamutCheck, Gtk::POS_RIGHT, 1, 1); } - void canSoftProof (bool canSP) - { - canSProof = canSP; - updateSoftProofParameters(); - } - void updateProcessor() { if (processor) { @@ -2305,7 +2290,6 @@ void EditorPanel::tbShowHideSidePanels_managestate() void EditorPanel::updateProfiles (const Glib::ustring &printerProfile, rtengine::RenderingIntent printerIntent, bool printerBPC) { - colorMgmtToolBar->canSoftProof (!printerProfile.empty() && printerProfile != "None"); } void EditorPanel::updateTPVScrollbar (bool hide)