From bee52d7442e62ae90f6c68acee050331780df628 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Thu, 1 Feb 2018 16:30:45 +0100 Subject: [PATCH 1/7] Text toggle button hover animation and stricter targetting #4350 --- rtdata/themes/RawTherapee-GTK3-20_.css | 12 ++++++++++-- rtdata/themes/RawTherapee-GTK3-_19.css | 13 +++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/rtdata/themes/RawTherapee-GTK3-20_.css b/rtdata/themes/RawTherapee-GTK3-20_.css index f32455ca3..ba58e412f 100644 --- a/rtdata/themes/RawTherapee-GTK3-20_.css +++ b/rtdata/themes/RawTherapee-GTK3-20_.css @@ -325,14 +325,22 @@ scale:disabled trough { } /* Better on/off state separation for text toggle buttons, e.g. auto-levels or histogram matching. */ -button.text-button { +button.text-button.toggle { background-image: linear-gradient(to bottom, rgba(100,100,100,.3), rgba(30,30,30,.3)); } -button.text-button:checked { +button.text-button.toggle:hover { + background-image: linear-gradient(to bottom, rgba(128,128,128,.3), rgba(64,64,64,.3)); +} + +button.text-button.toggle:checked { background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4)); } +button.text-button.toggle:hover:checked { + background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3)); +} + separator { color: #363636; margin: 5px; diff --git a/rtdata/themes/RawTherapee-GTK3-_19.css b/rtdata/themes/RawTherapee-GTK3-_19.css index cfbec4355..5a0b328b0 100644 --- a/rtdata/themes/RawTherapee-GTK3-_19.css +++ b/rtdata/themes/RawTherapee-GTK3-_19.css @@ -507,10 +507,19 @@ GtkNotebook { padding-right: 3px; } -GtkButton.text-button { +/* Better on/off state separation for text toggle buttons, e.g. auto-levels or histogram matching. */ +GtkButton.text-button.toggle { background-image: linear-gradient(to bottom, rgba(100,100,100,.3), rgba(30,30,30,.3)); } -GtkButton.text-button:checked { +GtkButton.text-button.toggle:hover { + background-image: linear-gradient(to bottom, rgba(128,128,128,.3), rgba(64,64,64,.3)); +} + +GtkButton.text-button.toggle:checked { background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4)); } + +GtkButton.text-button.toggle:hover:checked { + background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3)); +} From db3111b0d327d0c4511fdb996cbc8728e5ef1f8c Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Fri, 2 Feb 2018 02:27:29 +0100 Subject: [PATCH 2/7] Text toggle button fix for GTK+ <=3.18 #4350 GTK+ <=3.18 requires different selectors than >=3.20. --- rtdata/themes/RawTherapee-GTK3-_19.css | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtdata/themes/RawTherapee-GTK3-_19.css b/rtdata/themes/RawTherapee-GTK3-_19.css index 5a0b328b0..8d549f8bf 100644 --- a/rtdata/themes/RawTherapee-GTK3-_19.css +++ b/rtdata/themes/RawTherapee-GTK3-_19.css @@ -508,18 +508,18 @@ GtkNotebook { } /* Better on/off state separation for text toggle buttons, e.g. auto-levels or histogram matching. */ -GtkButton.text-button.toggle { +GtkToggleButton.button.text-button { background-image: linear-gradient(to bottom, rgba(100,100,100,.3), rgba(30,30,30,.3)); } -GtkButton.text-button.toggle:hover { +GtkToggleButton.button.text-button:hover { background-image: linear-gradient(to bottom, rgba(128,128,128,.3), rgba(64,64,64,.3)); } -GtkButton.text-button.toggle:checked { +GtkToggleButton.button.text-button:checked { background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4)); } -GtkButton.text-button.toggle:hover:checked { +GtkToggleButton.text-button:hover:checked { background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3)); } From 8bc414948d7690f3bf4165b9afefed712bee48da Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 2 Feb 2018 12:14:15 +0100 Subject: [PATCH 3/7] fixed typo in ImProcFunctions::chromiLuminanceCurve (thanks Floessie) Fixes #4355 --- rtengine/improcfun.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 1a545bdf5..37a3e707f 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -5774,7 +5774,7 @@ void ImProcFunctions::chromiLuminanceCurve (PipetteBuffer *pipetteBuffer, int pW float aprov1 = Chprov2 * sincosval.y; float bprov1 = Chprov2 * sincosval.x; - float fy = (Color::c1By116 * Lprov1 ) + Color::c1By116; + float fy = (Color::c1By116 * Lprov1 ) + Color::c16By116; float fx = (0.002f * aprov1) + fy; float fz = fy - (0.005f * bprov1); From e265d23e76ee787acdfe4d6c2aae1b9153feefcd Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Fri, 2 Feb 2018 13:57:43 +0100 Subject: [PATCH 4/7] made histogram matching depend on the input profile This improves the accuracy of the matching when using non-default profiles --- rtengine/histmatching.cc | 21 +++++++++++++++++++-- rtengine/imagesource.h | 2 +- rtengine/improccoordinator.cc | 2 +- rtengine/rawimagesource.h | 3 ++- rtengine/refreshmap.cc | 6 +++--- rtengine/simpleprocess.cc | 2 +- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index f0b49cddd..d63428738 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -169,7 +169,7 @@ void mappingToCurve(const std::vector &mapping, std::vector &curve) } // namespace -void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) +void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector &outCurve) { BENCHFUN @@ -177,7 +177,18 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) std::cout << "performing histogram matching for " << getFileName() << " on the embedded thumbnail" << std::endl; } - if (!histMatchingCache.empty()) { + const auto same_profile = + [](const ColorManagementParams &a, const ColorManagementParams &b) -> bool + { + return (a.input == b.input + && a.toneCurve == b.toneCurve + && a.applyLookTable == b.applyLookTable + && a.applyBaselineExposureOffset == b.applyBaselineExposureOffset + && a.applyHueSatMap == b.applyHueSatMap + && a.dcpIlluminant == b.dcpIlluminant); + }; + + if (!histMatchingCache.empty() && same_profile(histMatchingParams, cp)) { if (settings->verbose) { std::cout << "tone curve found in cache" << std::endl; } @@ -196,9 +207,12 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) } ProcParams neutral; + neutral.icm = cp; neutral.raw.bayersensor.method = RAWParams::BayerSensor::getMethodString(RAWParams::BayerSensor::Method::FAST); neutral.raw.xtranssensor.method = RAWParams::XTransSensor::getMethodString(RAWParams::XTransSensor::Method::FAST); neutral.icm.output = "sRGB"; + neutral.icm.gamma = "default"; + neutral.icm.freegamma = false; std::unique_ptr source; { @@ -211,6 +225,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) std::cout << "histogram matching: no thumbnail found, generating a neutral curve" << std::endl; } histMatchingCache = outCurve; + histMatchingParams = cp; return; } skip = LIM(skip * fh / h, 6, 10); // adjust the skip factor -- the larger the thumbnail, the less we should skip to get a good match @@ -233,6 +248,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) std::cout << "histogram matching: raw decoding failed, generating a neutral curve" << std::endl; } histMatchingCache = outCurve; + histMatchingParams = cp; return; } target.reset(thumb->processImage(neutral, sensor_type, fh / skip, TI_Nearest, getMetaData(), scale, false, true)); @@ -304,6 +320,7 @@ void RawImageSource::getAutoMatchedToneCurve(std::vector &outCurve) } histMatchingCache = outCurve; + histMatchingParams = cp; } } // namespace rtengine diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index 675243b65..af9eecc35 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -139,7 +139,7 @@ public: } // for RAW files, compute a tone curve using histogram matching on the embedded thumbnail - virtual void getAutoMatchedToneCurve(std::vector &outCurve) + virtual void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector &outCurve) { outCurve = { 0.0 }; } diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 62891a03f..3c0a8e450 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -447,7 +447,7 @@ void ImProcCoordinator::updatePreviewImage (int todo, Crop* cropCall) params.toneCurve.black, params.toneCurve.hlcompr, params.toneCurve.hlcomprthresh, params.toneCurve.hrenabled); } if (params.toneCurve.histmatching) { - imgsrc->getAutoMatchedToneCurve(params.toneCurve.curve); + imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve); if (params.toneCurve.autoexp) { params.toneCurve.expcomp = 0.0; diff --git a/rtengine/rawimagesource.h b/rtengine/rawimagesource.h index 59316eccf..ff7d2c1f9 100644 --- a/rtengine/rawimagesource.h +++ b/rtengine/rawimagesource.h @@ -96,6 +96,7 @@ protected: float psBlueBrightness[4]; std::vector histMatchingCache; + ColorManagementParams histMatchingParams; void hphd_vertical (float** hpmap, int col_from, int col_to); void hphd_horizontal (float** hpmap, int row_from, int row_to); @@ -186,7 +187,7 @@ public: } void getAutoExpHistogram (LUTu & histogram, int& histcompr); void getRAWHistogram (LUTu & histRedRaw, LUTu & histGreenRaw, LUTu & histBlueRaw); - void getAutoMatchedToneCurve(std::vector &outCurve); + void getAutoMatchedToneCurve(const ColorManagementParams &cp, std::vector &outCurve); DCPProfile *getDCP(const ColorManagementParams &cmp, DCPProfile::ApplyState &as); void convertColorSpace(Imagefloat* image, const ColorManagementParams &cmp, const ColorTemp &wb); diff --git a/rtengine/refreshmap.cc b/rtengine/refreshmap.cc index e76338fc0..b467c5564 100644 --- a/rtengine/refreshmap.cc +++ b/rtengine/refreshmap.cc @@ -74,7 +74,7 @@ int refreshmap[rtengine::NUMOFEVENTS] = { 0, // EvLDNEdgeTolerance: obsolete, 0, // EvCDNEnabled:obsolete, 0, // free entry - RGBCURVE, // EvDCPToneCurve, + RGBCURVE|M_AUTOEXP, // EvDCPToneCurve, ALLNORAW, // EvDCPIlluminant, RETINEX, // EvSHEnabled, RGBCURVE, // EvSHHighlights, @@ -419,8 +419,8 @@ int refreshmap[rtengine::NUMOFEVENTS] = { DIRPYREQUALIZER, // EvWavgreenlow DIRPYREQUALIZER, // EvWavbluelow DIRPYREQUALIZER, // EvWavNeutral - RGBCURVE, // EvDCPApplyLookTable, - RGBCURVE, // EvDCPApplyBaselineExposureOffset, + RGBCURVE|M_AUTOEXP, // EvDCPApplyLookTable, + RGBCURVE|M_AUTOEXP, // EvDCPApplyBaselineExposureOffset, ALLNORAW, // EvDCPApplyHueSatMap DIRPYREQUALIZER, // EvWavenacont DIRPYREQUALIZER, // EvWavenachrom diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index 685e1d53e..06e811420 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -741,7 +741,7 @@ private: ipf.getAutoExp (aehist, aehistcompr, params.toneCurve.clip, expcomp, bright, contr, black, hlcompr, hlcomprthresh); } if (params.toneCurve.histmatching) { - imgsrc->getAutoMatchedToneCurve(params.toneCurve.curve); + imgsrc->getAutoMatchedToneCurve(params.icm, params.toneCurve.curve); if (params.toneCurve.autoexp) { params.toneCurve.expcomp = 0.0; From d91f177f573eaf228eb4b5ced49b9fce8c2b4a16 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Fri, 2 Feb 2018 15:57:22 +0100 Subject: [PATCH 5/7] Added missing selector #4350 --- rtdata/themes/RawTherapee-GTK3-_19.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtdata/themes/RawTherapee-GTK3-_19.css b/rtdata/themes/RawTherapee-GTK3-_19.css index 8d549f8bf..a796b60a1 100644 --- a/rtdata/themes/RawTherapee-GTK3-_19.css +++ b/rtdata/themes/RawTherapee-GTK3-_19.css @@ -520,6 +520,6 @@ GtkToggleButton.button.text-button:checked { background-image: linear-gradient(to bottom, rgba(30,30,30,.3), rgba(0,0,0,.4)); } -GtkToggleButton.text-button:hover:checked { +GtkToggleButton.button.text-button:hover:checked { background-image: linear-gradient(to bottom, rgba(48,48,48,.3), rgba(0,0,0,.3)); } From 3e2e7717b12e0e930b18f650bce4c570116ca699 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sat, 3 Feb 2018 12:57:36 +0100 Subject: [PATCH 6/7] Fix random behaviour when opening images in SETM and 'Auto zoom to fit the crop area' is enabled, fixes #4357 --- rtgui/cropwindow.cc | 2 +- rtgui/cropwindow.h | 2 +- rtgui/editorpanel.cc | 1 - rtgui/imagearea.cc | 28 +++++++++------------------- rtgui/imagearea.h | 3 +-- 5 files changed, 12 insertions(+), 24 deletions(-) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 001805362..6691fc997 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -2577,7 +2577,7 @@ void CropWindow::initialImageArrived () { for (auto listener : listeners) { - listener->initialImageArrived (this); + listener->initialImageArrived(); } } diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index c1d7c59cc..b1b419c33 100644 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -40,7 +40,7 @@ public: virtual void cropPositionChanged (CropWindow*) {} virtual void cropWindowSizeChanged (CropWindow*) {} virtual void cropZoomChanged (CropWindow*) {} - virtual void initialImageArrived (CropWindow*) {} + virtual void initialImageArrived () {} }; class ImageArea; diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 9c23053aa..21753bcf5 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1068,7 +1068,6 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) // since there was no resize event if (iareapanel->imageArea->mainCropWindow) { iareapanel->imageArea->mainCropWindow->cropHandler.newImage (ipc, false); - iareapanel->imageArea->mainCropWindow->initialImageArrived(); // In single tab mode, the image is not always updated between switches // normal redraw don't work, so this is the hard way diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 4c4f78a38..55444a916 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -25,7 +25,7 @@ #include "../rtengine/refreshmap.h" #include "options.h" -ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), firstOpen(true), fullImageWidth(0), fullImageHeight(0) +ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), fullImageWidth(0), fullImageHeight(0) { infotext = ""; @@ -633,33 +633,23 @@ void ImageArea::setZoom (double zoom) zoomPanel->refreshZoomLabel (); } -void ImageArea::initialImageArrived (CropWindow* cw) +void ImageArea::initialImageArrived () { if (mainCropWindow) { - if(firstOpen || options.prevdemo != PD_Sidecar || (!options.rememberZoomAndPan) ) { + int w, h; + mainCropWindow->cropHandler.getFullImageSize(w, h); + if(options.prevdemo != PD_Sidecar || !options.rememberZoomAndPan || w != fullImageWidth || h != fullImageHeight) { if (options.cropAutoFit || options.bgcolor != 0) { mainCropWindow->zoomFitCrop(); } else { mainCropWindow->zoomFit(); } - firstOpen = false; - mainCropWindow->cropHandler.getFullImageSize(fullImageWidth, fullImageHeight); - } else { - int w, h; - mainCropWindow->cropHandler.getFullImageSize(w, h); - - if(w != fullImageWidth || h != fullImageHeight) { - if (options.cropAutoFit) { - mainCropWindow->zoomFitCrop(); - } else { - mainCropWindow->zoomFit(); - } - } - - fullImageWidth = w; - fullImageHeight = h; + } else if ((options.cropAutoFit || options.bgcolor != 0) && mainCropWindow->cropHandler.cropParams.enabled) { + mainCropWindow->zoomFitCrop(); } + fullImageWidth = w; + fullImageHeight = h; } } diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index 91820beb1..65fc14cce 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -65,7 +65,6 @@ protected: void get_preferred_height_for_width_vfunc (int width, int &minimum_height, int &natural_height) const; void get_preferred_width_for_height_vfunc (int height, int &minimum_width, int &natural_width) const; - bool firstOpen; int fullImageWidth, fullImageHeight; public: CropWindow* mainCropWindow; @@ -148,7 +147,7 @@ public: void cropPositionChanged (CropWindow* cw); void cropWindowSizeChanged (CropWindow* cw); void cropZoomChanged (CropWindow* cw); - void initialImageArrived (CropWindow* cw) ; + void initialImageArrived (); // LockablePickerToolListener interface void switchPickerVisibility (bool isVisible); From 1d037397f1b780886fd718348daf32b45ddc60db Mon Sep 17 00:00:00 2001 From: heckflosse Date: Sun, 4 Feb 2018 00:13:12 +0100 Subject: [PATCH 7/7] Navigator width and height of image not updated when changing images, fixes #4359 --- rtgui/editorpanel.cc | 1 + rtgui/navigator.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index 21753bcf5..7f5869a95 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -1081,6 +1081,7 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) } history->resetSnapShotNumber(); + navigator->setInvalid(ipc->getFullWidth(),ipc->getFullHeight()); } void EditorPanel::close () diff --git a/rtgui/navigator.h b/rtgui/navigator.h index 647df7a34..e6ca33559 100644 --- a/rtgui/navigator.h +++ b/rtgui/navigator.h @@ -46,7 +46,6 @@ protected: Gtk::Label *lH, *lS, *lV; Gtk::Label *lLAB_A, *lLAB_B, *lLAB_L; - void setInvalid (int fullWidth = -1, int fullHeight = -1); public: PreviewWindow* previewWindow; @@ -56,6 +55,7 @@ public: // pointermotionlistener interface // void pointerMoved (bool validPos, int x, int y, int r, int g, int b); void pointerMoved (bool validPos, Glib::ustring profile, Glib::ustring profileW, int x, int y, int r, int g, int b); + void setInvalid (int fullWidth = -1, int fullHeight = -1); void getRGBText (int r, int g, int b, Glib::ustring &sR, Glib::ustring &sG, Glib::ustring &sB); void getHSVText (float h, float s, float v, Glib::ustring &sH, Glib::ustring &sS, Glib::ustring &sV);