From e4ba4d19f5e425b461e4031d1ff200a0f976d70e Mon Sep 17 00:00:00 2001 From: Alberto Griggio Date: Sun, 10 Sep 2017 22:02:43 +0200 Subject: [PATCH] made lensfun-based correction compatible with auto fill mode --- rtengine/iptransform.cc | 4 ---- rtengine/lcp.h | 2 -- rtengine/rtlensfun.cc | 2 ++ rtengine/rtlensfun.h | 1 - rtgui/lensprofile.cc | 21 --------------------- rtgui/lensprofile.h | 6 ------ rtgui/toolpanelcoord.cc | 1 - 7 files changed, 2 insertions(+), 35 deletions(-) diff --git a/rtengine/iptransform.cc b/rtengine/iptransform.cc index 2226c493b..77da87e4c 100644 --- a/rtengine/iptransform.cc +++ b/rtengine/iptransform.cc @@ -969,10 +969,6 @@ double ImProcFunctions::getTransformAutoFill (int oW, int oH, const LensCorrecti return 1; } - if (pLCPMap && !pLCPMap->supportsAutoFill()) { - return 1; - } - double scaleU = 2, scaleL = 0.001; // upper and lower border, iterate inbetween do { diff --git a/rtengine/lcp.h b/rtengine/lcp.h index 1a4b677d3..f3aca09cd 100644 --- a/rtengine/lcp.h +++ b/rtengine/lcp.h @@ -140,7 +140,6 @@ class LensCorrection { public: virtual ~LensCorrection() {} virtual void correctDistortion(double &x, double &y, int cx, int cy, double scale) const = 0; - virtual bool supportsAutoFill() const = 0; virtual bool supportsCA() const = 0; virtual void correctCA(double &x, double &y, int channel) const = 0; virtual void processVignetteLine(int width, int y, float *line) const = 0; @@ -167,7 +166,6 @@ public: void correctDistortion(double &x, double &y, int cx, int cy, double scale) const; // MUST be the first stage bool supportsCA() const { return enableCA; } - bool supportsAutoFill() const { return true; } void correctCA(double& x, double& y, int channel) const; void processVignetteLine(int width, int y, float *line) const; void processVignetteLine3Channels(int width, int y, float *line) const; diff --git a/rtengine/rtlensfun.cc b/rtengine/rtlensfun.cc index a758c1872..15ec001eb 100644 --- a/rtengine/rtlensfun.cc +++ b/rtengine/rtlensfun.cc @@ -72,6 +72,8 @@ void LFModifier::correctDistortion(double &x, double &y, int cx, int cy, double x -= cx; y -= cy; } + x *= scale; + y *= scale; } diff --git a/rtengine/rtlensfun.h b/rtengine/rtlensfun.h index 640b6a18c..fce7d3a18 100644 --- a/rtengine/rtlensfun.h +++ b/rtengine/rtlensfun.h @@ -34,7 +34,6 @@ public: bool ok() const; void correctDistortion(double &x, double &y, int cx, int cy, double scale) const; - bool supportsAutoFill() const { return false; } bool supportsCA() const { return false; } void correctCA(double &x, double &y, int channel) const {} void processVignetteLine(int width, int y, float *line) const; diff --git a/rtgui/lensprofile.cc b/rtgui/lensprofile.cc index 12d220271..9eb41aa25 100644 --- a/rtgui/lensprofile.cc +++ b/rtgui/lensprofile.cc @@ -39,7 +39,6 @@ LensProfilePanel::LensProfilePanel () : useCAChanged(false), isRaw(true), metadata(nullptr), - lensgeomLcpFill(nullptr), useLensfunChanged(false), lensfunAutoChanged(false), lensfunCameraChanged(false), @@ -220,7 +219,6 @@ void LensProfilePanel::read(const rtengine::procparams::ProcParams* pp, const Pa corrOff->set_active(true); } - setAutoFill(); enableListener (); conUseDist.block(false); } @@ -516,8 +514,6 @@ void LensProfilePanel::onCorrModeChanged() mode = M("GENERAL_UNCHANGED"); } - setAutoFill(); - if (listener) { listener->panelChanged(EvLensCorrMode, mode); } @@ -537,23 +533,6 @@ bool LensProfilePanel::checkLensfunCanCorrect(bool automatch) } -void LensProfilePanel::setAutoFill() -{ - if (lensgeomLcpFill) { - bool b = lensgeomLcpFill->disableListener(); - if (corrLensfunAuto->get_active() || corrLensfunManual->get_active()) { - lensgeomLcpFill->getFill()->set_active(true); - lensgeomLcpFill->getFill()->set_sensitive(false); - } else { - lensgeomLcpFill->getFill()->set_sensitive(true); - } - if (b) { - lensgeomLcpFill->enableListener(); - } - } -} - - //----------------------------------------------------------------------------- // LFDbHelper //----------------------------------------------------------------------------- diff --git a/rtgui/lensprofile.h b/rtgui/lensprofile.h index 9475792ae..5e2a5b484 100644 --- a/rtgui/lensprofile.h +++ b/rtgui/lensprofile.h @@ -40,7 +40,6 @@ protected: bool allowFocusDep; bool isRaw; const rtengine::ImageMetaData* metadata; - LensGeometry *lensgeomLcpFill; Gtk::RadioButton::Group corrGroup; Gtk::RadioButton *corrOff; @@ -87,7 +86,6 @@ protected: bool setLensfunCamera(const Glib::ustring &make, const Glib::ustring &model); bool setLensfunLens(const Glib::ustring &lens); bool checkLensfunCanCorrect(bool automatch); - void setAutoFill(); public: @@ -102,10 +100,6 @@ public: void onUseDistChanged(); void onUseVignChanged(); void onUseCAChanged(); - void setLensGeomRef( LensGeometry *foo) - { - lensgeomLcpFill = foo ; - }; void setBatchMode(bool yes); diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index e30309fdf..0052e35ca 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -53,7 +53,6 @@ ToolPanelCoordinator::ToolPanelCoordinator () : ipc (nullptr), hasChanged (false colortoning = Gtk::manage (new ColorToning ()); lensgeom = Gtk::manage (new LensGeometry ()); lensProf = Gtk::manage (new LensProfilePanel ()); - lensProf->setLensGeomRef (lensgeom); distortion = Gtk::manage (new Distortion ()); rotate = Gtk::manage (new Rotate ()); vibrance = Gtk::manage (new Vibrance ());