From 1f42e5cdd490555312bd79c8b036147f41ed5adc Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 5 Feb 2018 16:01:00 +0100 Subject: [PATCH] Avoid unnecessary update to main preview when opening first detail window, fixes #4368 --- rtengine/improccoordinator.cc | 23 ++++++++++++++++++++++- rtengine/improccoordinator.h | 4 +++- rtengine/rtengine.h | 3 +++ rtgui/imagearea.cc | 3 ++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 3c0a8e450..b35b9f661 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -90,7 +90,7 @@ ImProcCoordinator::ImProcCoordinator () pW (-1), pH (-1), plistener (nullptr), imageListener (nullptr), aeListener (nullptr), acListener (nullptr), abwListener (nullptr), awbListener (nullptr), frameCountListener (nullptr), imageTypeListener (nullptr), actListener (nullptr), adnListener (nullptr), awavListener (nullptr), dehaListener (nullptr), hListener (nullptr), resultValid (false), lastOutputProfile ("BADFOOD"), lastOutputIntent (RI__COUNT), lastOutputBPC (false), thread (nullptr), changeSinceLast (0), updaterRunning (false), destroying (false), utili (false), autili (false), - butili (false), ccutili (false), cclutili (false), clcutili (false), opautili (false), wavcontlutili (false), colourToningSatLimit (0.f), colourToningSatLimitOpacity (0.f) + butili (false), ccutili (false), cclutili (false), clcutili (false), opautili (false), wavcontlutili (false), colourToningSatLimit (0.f), colourToningSatLimitOpacity (0.f), highQualityComputed (false) {} void ImProcCoordinator::assign (ImageSource* imgsrc) @@ -1388,5 +1388,26 @@ void ImProcCoordinator::endUpdateParams (int changeFlags) startProcessing (); } +bool ImProcCoordinator::getHighQualComputed() { + // this function may only be called from detail windows + if(!highQualityComputed) { + if(options.prevdemo == PD_Sidecar) { + // we already have high quality preview + setHighQualComputed(); + } else { + for (size_t i = 0; i < crops.size() - 1; ++i) { // -1, because last entry is the freshly created detail window + if (crops[i]->get_skip() == 1 ) { // there is at least one crop with skip == 1 => we already have high quality preview + setHighQualComputed(); + break; + } + } + } + } + return highQualityComputed; +} + +void ImProcCoordinator::setHighQualComputed() { + highQualityComputed = true; +} } diff --git a/rtengine/improccoordinator.h b/rtengine/improccoordinator.h index 2f5fe52e5..ab599bfb3 100644 --- a/rtengine/improccoordinator.h +++ b/rtengine/improccoordinator.h @@ -212,6 +212,7 @@ protected: void process (); float colourToningSatLimit; float colourToningSatLimitOpacity; + bool highQualityComputed; public: @@ -266,7 +267,8 @@ public: void getCamWB (double& temp, double& green); void getSpotWB (int x, int y, int rectSize, double& temp, double& green); void getAutoCrop (double ratio, int &x, int &y, int &w, int &h); - + bool getHighQualComputed(); + void setHighQualComputed(); void setMonitorProfile (const Glib::ustring& profile, RenderingIntent intent); void getMonitorProfile (Glib::ustring& profile, RenderingIntent& intent) const; void setSoftProofing (bool softProof, bool gamutCheck); diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index eea15c7a3..22b05d91f 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -440,6 +440,9 @@ public: * @return the height of the preview image */ virtual int getPreviewHeight () = 0; + virtual bool getHighQualComputed() = 0; + virtual void setHighQualComputed() = 0; + virtual bool updateTryLock() = 0; virtual void updateUnLock() = 0; diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index 55444a916..42370d096 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -505,8 +505,9 @@ void ImageArea::addCropWindow () mainCropWindow->setObservedCropWin (cropWins.front()); - if(cropWins.size() == 1) { // after first detail window we already have high quality + if(!ipc->getHighQualComputed()) { ipc->startProcessing(M_HIGHQUAL); + ipc->setHighQualComputed(); } }