From de3d667ed7982736ae2648b4418ae9f1b6086c2b Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 15:15:37 +0200 Subject: [PATCH 01/10] review adjuster class: reduce memory allocations/deallocations, also small speedup for adjuster creation --- rtgui/adjuster.cc | 293 +++++++++++++++++---------------------- rtgui/adjuster.h | 41 +++--- rtgui/dirpyrequalizer.cc | 2 +- rtgui/wavelet.cc | 4 +- 4 files changed, 151 insertions(+), 189 deletions(-) diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index 46aa3952b..f2ea3f0b4 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -27,81 +27,80 @@ #define MIN_RESET_BUTTON_HEIGHT 17 -static double one2one(double val) +namespace { +double one2one(double val) { return val; } +} + +Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value_, double2double_fun value2slider_) : + adjustmentName(std::move(vlabel)), + grid(nullptr), + label(nullptr), + imageIcon1(imgIcon1), + automatic(nullptr), + adjusterListener(nullptr), + editedCheckBox(nullptr), + afterReset(false), + blocked(false), + addMode(false), + eventPending(false), + vMin(vmin), + vMax(vmax), + vStep(vstep), + logBase(0), + logPivot(0), + logAnchorMiddle(false), + value2slider(value2slider_ ? value2slider_ : one2one), + slider2value(slider2value_ ? slider2value_ : one2one), + delay(options.adjusterMinDelay) -Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value_, double2double_fun value2slider_) { - set_hexpand(true); set_vexpand(false); - label = nullptr; - adjusterListener = nullptr; - afterReset = false; - blocked = false; - automatic = nullptr; - eventPending = false; - grid = NULL; - imageIcon1 = imgIcon1; - - logBase = 0; - logPivot = 0; - logAnchorMiddle = false; if (imageIcon1) { setExpandAlignProperties(imageIcon1, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); } - imageIcon2 = imgIcon2; - - if (imageIcon2) { - setExpandAlignProperties(imageIcon2, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); + if (imgIcon2) { + setExpandAlignProperties(imgIcon2, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); } - slider2value = slider2value_ ? slider2value_ : one2one; - value2slider = value2slider_ ? value2slider_ : one2one; - vMin = vmin; - vMax = vmax; - vStep = vstep; - addMode = false; - - delay = options.adjusterMinDelay; - set_column_spacing(0); set_column_homogeneous(false); set_row_spacing(0); set_row_homogeneous(false); - editedCheckBox = nullptr; - - if (!vlabel.empty()) { - adjustmentName = vlabel; - label = Gtk::manage (new Gtk::Label (adjustmentName)); + if (!adjustmentName.empty()) { + label = Gtk::manage(new Gtk::Label(adjustmentName)); setExpandAlignProperties(label, true, false, Gtk::ALIGN_START, Gtk::ALIGN_BASELINE); } - reset = Gtk::manage (new Gtk::Button ()); - reset->add (*Gtk::manage (new RTImage ("undo-small.png", "redo-small.png"))); + reset = Gtk::manage(new Gtk::Button()); + + reset->add(*Gtk::manage(new RTImage("undo-small.png", "redo-small.png"))); setExpandAlignProperties(reset, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); - reset->set_relief (Gtk::RELIEF_NONE); - reset->set_tooltip_markup (M("ADJUSTER_RESET_TO_DEFAULT")); + reset->set_relief(Gtk::RELIEF_NONE); + reset->set_tooltip_markup(M("ADJUSTER_RESET_TO_DEFAULT")); reset->get_style_context()->add_class(GTK_STYLE_CLASS_FLAT); reset->set_can_focus(false); - spin = Gtk::manage (new MySpinButton ()); + spin = Gtk::manage(new MySpinButton()); + setExpandAlignProperties(spin, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); spin->set_input_purpose(Gtk::INPUT_PURPOSE_DIGITS); - reset->set_size_request (-1, spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT); - - slider = Gtk::manage (new MyHScale ()); + reset->set_size_request(-1, spin->get_height() > MIN_RESET_BUTTON_HEIGHT ? spin->get_height() : MIN_RESET_BUTTON_HEIGHT); + slider = Gtk::manage(new MyHScale()); setExpandAlignProperties(slider, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER); - slider->set_draw_value (false); + slider->set_draw_value(false); //slider->set_has_origin(false); // ------------------ This will remove the colored part on the left of the slider's knob - if (vlabel.empty()) { + setLimits(vmin, vmax, vstep, vdefault); + + if (adjustmentName.empty()) { // No label, everything goes in a single row attach_next_to(*slider, Gtk::POS_LEFT, 1, 1); @@ -109,9 +108,9 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1); } - if (imageIcon2) { - attach_next_to(*imageIcon2, *slider, Gtk::POS_RIGHT, 1, 1); - attach_next_to(*spin, *imageIcon2, Gtk::POS_RIGHT, 1, 1); + if (imgIcon2) { + attach_next_to(*imgIcon2, *slider, Gtk::POS_RIGHT, 1, 1); + attach_next_to(*spin, *imgIcon2, Gtk::POS_RIGHT, 1, 1); } else { attach_next_to(*spin, *slider, Gtk::POS_RIGHT, 1, 1); } @@ -129,9 +128,9 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep grid->attach_next_to(*imageIcon1, *slider, Gtk::POS_LEFT, 1, 1); } - if (imageIcon2) { - grid->attach_next_to(*imageIcon2, Gtk::POS_RIGHT, 1, 1); - grid->attach_next_to(*reset, *imageIcon2, Gtk::POS_RIGHT, 1, 1); + if (imgIcon2) { + grid->attach_next_to(*imgIcon2, Gtk::POS_RIGHT, 1, 1); + grid->attach_next_to(*reset, *imgIcon2, Gtk::POS_RIGHT, 1, 1); } else { grid->attach_next_to(*reset, *slider, Gtk::POS_RIGHT, 1, 1); } @@ -139,37 +138,31 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep attach_next_to(*grid, *label, Gtk::POS_BOTTOM, 2, 1); } - setLimits (vmin, vmax, vstep, vdefault); - - defaultVal = shapeValue (vdefault); - ctorDefaultVal = shapeValue (vdefault); + defaultVal = ctorDefaultVal = shapeValue(vdefault); editedState = defEditedState = Irrelevant; - autoState = Irrelevant; sliderChange = slider->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::sliderChanged) ); - spinChange = spin->signal_value_changed().connect ( sigc::mem_fun(*this, &Adjuster::spinChanged), true); + spinChange = spin->signal_value_changed().connect( sigc::mem_fun(*this, &Adjuster::spinChanged), true); reset->signal_button_release_event().connect_notify( sigc::mem_fun(*this, &Adjuster::resetPressed) ); - show_all (); + show_all(); } Adjuster::~Adjuster () { - sliderChange.block (true); - spinChange.block (true); - delayConnection.block (true); + sliderChange.block(true); + spinChange.block(true); + delayConnection.block(true); adjusterListener = nullptr; - if (automatic) { - delete automatic; - } + delete automatic; } void Adjuster::addAutoButton (Glib::ustring tooltip) { if (!automatic) { - automatic = new Gtk::CheckButton (); + automatic = new Gtk::CheckButton(); //automatic->add (*Gtk::manage (new RTImage ("gears.png"))); automatic->set_tooltip_markup(tooltip.length() ? Glib::ustring::compose("%1\n\n%2", M("GENERAL_AUTO"), tooltip) : M("GENERAL_AUTO")); setExpandAlignProperties(automatic, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); @@ -185,15 +178,6 @@ void Adjuster::addAutoButton (Glib::ustring tooltip) } } -void Adjuster::delAutoButton () -{ - if (automatic) { - removeIfThere(grid, automatic); - delete automatic; - automatic = nullptr; - } -} - void Adjuster::throwOnButtonRelease(bool throwOnBRelease) { @@ -221,7 +205,7 @@ void Adjuster::throwOnButtonRelease(bool throwOnBRelease) void Adjuster::setDefault (double def) { - defaultVal = shapeValue (def); + defaultVal = shapeValue(def); } void Adjuster::setDefaultEditedState (EditedState eState) @@ -258,7 +242,7 @@ void Adjuster::sliderReleased (GdkEventButton* event) if ((event != nullptr) && (event->button == 1)) { if (delayConnection.connected()) { - delayConnection.disconnect (); + delayConnection.disconnect(); } notifyListener(); @@ -270,7 +254,7 @@ void Adjuster::spinReleased (GdkEventButton* event) if ((event != nullptr) && delay == 0) { if (delayConnection.connected()) { - delayConnection.disconnect (); + delayConnection.disconnect(); } notifyListener(); @@ -283,12 +267,11 @@ void Adjuster::resetValue (bool toInitial) editedState = defEditedState; if (editedCheckBox) { - editedChange.block (true); - editedCheckBox->set_active (defEditedState == Edited); - editedChange.block (false); + editedChange.block(true); + editedCheckBox->set_active(defEditedState == Edited); + editedChange.block(false); } - refreshLabelStyle (); } afterReset = true; @@ -317,32 +300,35 @@ void Adjuster::resetPressed (GdkEventButton* event) } } -double Adjuster::shapeValue (double a) +double Adjuster::shapeValue (double a) const { - double val = round(a * pow(double(10), digits)) / pow(double(10), digits); + const double pow10 = pow(10.0, digits); + const double val = round(a * pow10) / pow10; return val == -0.0 ? 0.0 : val; } void Adjuster::setLimits (double vmin, double vmax, double vstep, double vdefault) { + sliderChange.block(true); + spinChange.block(true); - sliderChange.block (true); - spinChange.block (true); + double pow10 = vstep; + for (digits = 0; fabs(pow10 - floor(pow10)) > 0.000000000001; digits++, pow10 *= 10.0); - for (digits = 0; fabs(vstep * pow(double(10), digits) - floor(vstep * pow(double(10), digits))) > 0.000000000001; digits++); - - spin->set_digits (digits); - spin->set_increments (vstep, 2.0 * vstep); - spin->set_range (vmin, vmax); + const double shapeVal = shapeValue(vdefault); + spin->set_digits(digits); + spin->set_increments(vstep, 2.0 * vstep); + spin->set_range(vmin, vmax); spin->updateSize(); - spin->set_value (shapeValue(vdefault)); - slider->set_digits (digits); - slider->set_increments (vstep, 2.0 * vstep); - slider->set_range (addMode ? vmin : value2slider(vmin), addMode ? vmax : value2slider(vmax)); - setSliderValue(addMode ? shapeValue(vdefault) : value2slider(shapeValue(vdefault))); - //defaultVal = shapeValue (vdefault); - sliderChange.block (false); - spinChange.block (false); + spin->set_value(shapeVal); + + slider->set_digits(digits); + slider->set_increments(vstep, 2.0 * vstep); + slider->set_range(addMode ? vmin : value2slider(vmin), addMode ? vmax : value2slider(vmax)); + setSliderValue(addMode ? shapeVal : value2slider(shapeVal)); + + sliderChange.block(false); + spinChange.block(false); } void Adjuster::setAddMode(bool addM) @@ -369,39 +355,36 @@ void Adjuster::setAddMode(bool addM) void Adjuster::spinChanged () { - if (delayConnection.connected()) { - delayConnection.disconnect (); + delayConnection.disconnect(); } - sliderChange.block (true); - setSliderValue(addMode ? spin->get_value () : value2slider(spin->get_value ())); - sliderChange.block (false); + sliderChange.block(true); + setSliderValue(addMode ? spin->get_value() : value2slider(spin->get_value())); + sliderChange.block(false); if (delay == 0) { if (adjusterListener && !blocked) { if (!buttonReleaseSlider.connected() || afterReset) { eventPending = false; - adjusterListener->adjusterChanged (this, spin->get_value ()); + adjusterListener->adjusterChanged(this, spin->get_value()); } else { eventPending = true; } } } else { eventPending = true; - delayConnection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Adjuster::notifyListener), delay); + delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay); } if (editedState == UnEdited) { editedState = Edited; if (editedCheckBox) { - editedChange.block (true); - editedCheckBox->set_active (true); - editedChange.block (false); + editedChange.block(true); + editedCheckBox->set_active(true); + editedChange.block(false); } - - refreshLabelStyle (); } afterReset = false; @@ -411,38 +394,36 @@ void Adjuster::sliderChanged () { if (delayConnection.connected()) { - delayConnection.disconnect (); + delayConnection.disconnect(); } - spinChange.block (true); - double v = shapeValue(getSliderValue()); - spin->set_value (addMode ? v : slider2value(v)); - spinChange.block (false); + spinChange.block(true); + const double v = shapeValue(getSliderValue()); + spin->set_value(addMode ? v : slider2value(v)); + spinChange.block(false); if (delay == 0 || afterReset) { if (adjusterListener && !blocked) { if (!buttonReleaseSlider.connected() || afterReset) { eventPending = false; - adjusterListener->adjusterChanged (this, spin->get_value ()); + adjusterListener->adjusterChanged(this, spin->get_value()); } else { eventPending = true; } } } else { eventPending = true; - delayConnection = Glib::signal_timeout().connect (sigc::mem_fun(*this, &Adjuster::notifyListener), delay); + delayConnection = Glib::signal_timeout().connect(sigc::mem_fun(*this, &Adjuster::notifyListener), delay); } if (!afterReset && editedState == UnEdited) { editedState = Edited; if (editedCheckBox) { - editedChange.block (true); - editedCheckBox->set_active (true); - editedChange.block (false); + editedChange.block(true); + editedCheckBox->set_active(true); + editedChange.block(false); } - - refreshLabelStyle (); } afterReset = false; @@ -450,20 +431,19 @@ void Adjuster::sliderChanged () void Adjuster::setValue (double a) { - - spinChange.block (true); - sliderChange.block (true); - spin->set_value (shapeValue (a)); - setSliderValue(addMode ? shapeValue(a) : value2slider(shapeValue (a))); - sliderChange.block (false); - spinChange.block (false); + spinChange.block(true); + sliderChange.block(true); + spin->set_value(shapeValue(a)); + setSliderValue(addMode ? shapeValue(a) : value2slider(shapeValue(a))); + sliderChange.block(false); + spinChange.block(false); afterReset = false; } void Adjuster::setAutoValue (bool a) { if (automatic) { - bool oldVal = autoChange.block(true); + const bool oldVal = autoChange.block(true); automatic->set_active(a); autoChange.block(oldVal); @@ -488,7 +468,7 @@ bool Adjuster::notifyListener () { if (eventPending && adjusterListener != nullptr && !blocked) { - adjusterListener->adjusterChanged (this, spin->get_value ()); + adjusterListener->adjusterChanged(this, spin->get_value()); } eventPending = false; @@ -509,12 +489,12 @@ bool Adjuster::notifyListenerAutoToggled () void Adjuster::setEnabled (bool enabled) { - bool autoVal = automatic && !editedCheckBox ? automatic->get_active() : true; - spin->set_sensitive (enabled && autoVal); - slider->set_sensitive (enabled && autoVal); + const bool autoVal = automatic && !editedCheckBox ? automatic->get_active() : true; + spin->set_sensitive(enabled && autoVal); + slider->set_sensitive(enabled && autoVal); if (automatic) { - automatic->set_sensitive (enabled); + automatic->set_sensitive(enabled); } } @@ -523,13 +503,12 @@ void Adjuster::setEditedState (EditedState eState) if (editedState != eState) { if (editedCheckBox) { - editedChange.block (true); - editedCheckBox->set_active (eState == Edited); - editedChange.block (false); + editedChange.block(true); + editedCheckBox->set_active(eState == Edited); + editedChange.block(false); } editedState = eState; - refreshLabelStyle (); } } @@ -537,7 +516,7 @@ EditedState Adjuster::getEditedState () { if (editedState != Irrelevant && editedCheckBox) { - editedState = editedCheckBox->get_active () ? Edited : UnEdited; + editedState = editedCheckBox->get_active() ? Edited : UnEdited; } return editedState; @@ -551,7 +530,7 @@ void Adjuster::showEditedCB () } if (!editedCheckBox) { - editedCheckBox = Gtk::manage(new Gtk::CheckButton (adjustmentName)); + editedCheckBox = Gtk::manage(new Gtk::CheckButton(adjustmentName)); editedCheckBox->set_vexpand(false); if (grid) { @@ -576,50 +555,38 @@ void Adjuster::showEditedCB () } } -void Adjuster::refreshLabelStyle () -{ - - /* Glib::RefPtr style = label->get_style_context (); - Pango::FontDescription fd = style->get_font (); - fd.set_weight (editedState==Edited ? Pango::WEIGHT_BOLD : Pango::WEIGHT_NORMAL); - style->set_font (fd); - label->set_style (style); - label->queue_draw ();*/ -} - void Adjuster::editedToggled () { if (adjusterListener && !blocked) { - adjusterListener->adjusterChanged (this, spin->get_value ()); + adjusterListener->adjusterChanged(this, spin->get_value()); } eventPending = false; } -void Adjuster::trimValue (double &val) +void Adjuster::trimValue (double &val) const { val = rtengine::LIM(val, vMin, vMax); } -void Adjuster::trimValue (int &val) +void Adjuster::trimValue (int &val) const { - val = rtengine::LIM(val, static_cast(vMin), static_cast(vMax)); + val = rtengine::LIM(val, vMin, vMax); } -void Adjuster::trimValue (float &val) +void Adjuster::trimValue (float &val) const { - val = rtengine::LIM(val, static_cast(vMin), static_cast(vMax)); + val = rtengine::LIM(val, vMin, vMax); } - -inline double Adjuster::getSliderValue() +inline double Adjuster::getSliderValue() const { double val = slider->get_value(); if (logBase) { @@ -683,15 +650,15 @@ inline void Adjuster::setSliderValue(double val) void Adjuster::setLogScale(double base, double pivot, bool anchorMiddle) { - spinChange.block (true); - sliderChange.block (true); + spinChange.block(true); + sliderChange.block(true); - double cur = getSliderValue(); + const double cur = getSliderValue(); logBase = base; logPivot = pivot; logAnchorMiddle = anchorMiddle; setSliderValue(cur); - sliderChange.block (false); - spinChange.block (false); + sliderChange.block(false); + spinChange.block(false); } diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 169bd7d12..2f3b10b18 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -43,7 +43,6 @@ protected: Gtk::Grid* grid; Gtk::Label* label; Gtk::Image *imageIcon1; - Gtk::Image *imageIcon2; MyHScale* slider; MySpinButton* spin; Gtk::Button* reset; @@ -60,7 +59,6 @@ protected: double ctorDefaultVal; // default value at construction time EditedState editedState; EditedState defEditedState; - EditedState autoState; int digits; Gtk::CheckButton* editedCheckBox; bool afterReset; @@ -75,28 +73,25 @@ protected: double logPivot; bool logAnchorMiddle; - double shapeValue (double a); - void refreshLabelStyle (); + double shapeValue (double a) const; double2double_fun value2slider, slider2value; - double getSliderValue(); + double getSliderValue() const; void setSliderValue(double val); public: int delay; - Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1 = nullptr, Gtk::Image *imgIcon2 = nullptr, double2double_fun slider2value = nullptr, double2double_fun value2slider = nullptr); + Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1 = nullptr, Gtk::Image *imgIcon2 = nullptr, double2double_fun slider2value_ = nullptr, double2double_fun value2slider_ = nullptr); ~Adjuster () override; // Add an "Automatic" checkbox next to the reset button. void addAutoButton(Glib::ustring tooltip = ""); - // Remove the "Automatic" checkbox next to the reset button. - void delAutoButton(); // Send back the value of og the Auto checkbox bool getAutoValue () { - return automatic != nullptr ? automatic->get_active () : false; + return automatic ? automatic->get_active() : false; } void setAutoValue (bool a); bool notifyListenerAutoToggled (); @@ -107,7 +102,7 @@ public: automatic->set_inconsistent(i); } } - bool getAutoInconsistent () + bool getAutoInconsistent () const { return automatic ? automatic->get_inconsistent() : true /* we have to return something */; } @@ -118,27 +113,27 @@ public: } // return the value trimmed to the limits at construction time - double getValue () + double getValue () const { - return shapeValue(spin->get_value ()); + return shapeValue(spin->get_value()); } // return the value trimmed to the limits at construction time - int getIntValue () + int getIntValue () const { - return spin->get_value_as_int (); + return spin->get_value_as_int(); } // return the value trimmed to the limits at construction time, // method only used by the history manager, so decoration is added if addMode=true - Glib::ustring getTextValue () + Glib::ustring getTextValue () const { if (addMode) { - return Glib::ustring::compose("%1", spin->get_text ()); + return Glib::ustring::compose("%1", spin->get_text()); } else { - return spin->get_text (); + return spin->get_text(); } } - void setLabel (Glib::ustring lbl) + void setLabel (const Glib::ustring &lbl) { label->set_label(lbl); } @@ -165,7 +160,7 @@ public: } void setAddMode(bool addM); - bool getAddMode() + bool getAddMode() const { return addMode; }; @@ -177,11 +172,11 @@ public: void resetValue (bool toInitial); void resetPressed (GdkEventButton* event); void editedToggled (); - void trimValue (double &val); - void trimValue (float &val); - void trimValue (int &val); + void trimValue (double &val) const; + void trimValue (float &val) const; + void trimValue (int &val) const; - void setLogScale(double base, double pivot, bool anchorMiddle=false); + void setLogScale(double base, double pivot, bool anchorMiddle = false); }; #endif diff --git a/rtgui/dirpyrequalizer.cc b/rtgui/dirpyrequalizer.cc index b63243465..5f557c0f1 100644 --- a/rtgui/dirpyrequalizer.cc +++ b/rtgui/dirpyrequalizer.cc @@ -99,7 +99,7 @@ DirPyrEqualizer::DirPyrEqualizer () : FoldableToolPanel(this, "dirpyrequalizer", ss += Glib::ustring::compose(" (%1)", M("TP_DIRPYREQUALIZER_LUMACOARSEST")); } - multiplier[i] = Gtk::manage ( new Adjuster (ss, 0, 4, 0.01, 1.0) ); + multiplier[i] = Gtk::manage(new Adjuster(std::move(ss), 0, 4, 0.01, 1.0)); multiplier[i]->setAdjusterListener(this); pack_start(*multiplier[i]); } diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index b9cf792db..942608414 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -290,7 +290,7 @@ Wavelet::Wavelet() : ss = Glib::ustring::compose( "%1", (i + 1)); } - correction[i] = Gtk::manage ( new Adjuster (ss, -100, 350, 1, 0) ); + correction[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 350, 1, 0)); correction[i]->setAdjusterListener(this); levBox->pack_start(*correction[i]); } @@ -398,7 +398,7 @@ Wavelet::Wavelet() : ss = Glib::ustring::compose( "%1", (i + 1)); } - correctionch[i] = Gtk::manage ( new Adjuster (ss, -100, 100, 1, 0) ); + correctionch[i] = Gtk::manage(new Adjuster(std::move(ss), -100, 100, 1, 0)); correctionch[i]->setAdjusterListener(this); chBox->pack_start(*correctionch[i]); } From 1be40beafad4e791536c5c994589899904d5d5ba Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 22:54:00 +0200 Subject: [PATCH 02/10] Scan clut folder: use std::set instead of std::set --- rtgui/filmsimulation.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 30ae09f9a..915e3a6d3 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -8,6 +8,8 @@ #include "../rtengine/clutstore.h" #include "../rtengine/procparams.h" +#define BENCHMARK +#include "../rtengine/StopWatch.h" using namespace rtengine; using namespace rtengine::procparams; @@ -305,6 +307,7 @@ ClutComboBox::ClutModel::ClutModel(const Glib::ustring &path) int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) { + BENCHFUNMICRO if (path.empty() || !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return 0; } @@ -364,7 +367,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) } // Fill menu structure with CLUT files - std::set entries; + std::set entries; unsigned long fileCount = 0; From ea2e9dd27434aefd629b8abc5d18ffe88e0e0752 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 23:04:14 +0200 Subject: [PATCH 03/10] Scan clut folder: check for .png first because most of cluts are png --- rtgui/filmsimulation.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 915e3a6d3..3c0c1de23 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -396,7 +396,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) HaldCLUT::splitClutFilename (entry, name, extension, profileName); extension = extension.casefold(); - if (extension.compare("tif") != 0 && extension.compare("png") != 0) { + if (extension != "png" && extension != "tif") { continue; } From 141e9f632fb7a7c61faebd4e623ff05cf2fda4bf Mon Sep 17 00:00:00 2001 From: heckflosse Date: Mon, 13 May 2019 23:12:40 +0200 Subject: [PATCH 04/10] Scan clut folder: Don't check for unused profile --- rtengine/clutstore.cc | 25 ++++++++++++++----------- rtengine/clutstore.h | 3 ++- rtgui/filmsimulation.cc | 2 +- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/rtengine/clutstore.cc b/rtengine/clutstore.cc index 9ee976907..10b7a2c38 100644 --- a/rtengine/clutstore.cc +++ b/rtengine/clutstore.cc @@ -270,7 +270,8 @@ void rtengine::HaldCLUT::splitClutFilename( const Glib::ustring& filename, Glib::ustring& name, Glib::ustring& extension, - Glib::ustring& profile_name + Glib::ustring& profile_name, + bool checkProfile ) { Glib::ustring basename = Glib::path_get_basename(filename); @@ -284,17 +285,19 @@ void rtengine::HaldCLUT::splitClutFilename( name = basename; } - profile_name = "sRGB"; + if (checkProfile) { + profile_name = "sRGB"; - if (!name.empty()) { - for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) { - if ( - !working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway - && std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin() - ) { - profile_name = working_profile; - name.erase(name.size() - working_profile.size()); - break; + if (!name.empty()) { + for (const auto& working_profile : rtengine::ICCStore::getInstance()->getWorkingProfiles()) { + if ( + !working_profile.empty() // This isn't strictly needed, but an empty wp name should be skipped anyway + && std::search(name.rbegin(), name.rend(), working_profile.rbegin(), working_profile.rend()) == name.rbegin() + ) { + profile_name = working_profile; + name.erase(name.size() - working_profile.size()); + break; + } } } } diff --git a/rtengine/clutstore.h b/rtengine/clutstore.h index a43526f78..cd94bc18b 100644 --- a/rtengine/clutstore.h +++ b/rtengine/clutstore.h @@ -39,7 +39,8 @@ public: const Glib::ustring& filename, Glib::ustring& name, Glib::ustring& extension, - Glib::ustring& profile_name + Glib::ustring& profile_name, + bool checkProfile = true ); private: diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index 3c0c1de23..dd29f1313 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -393,7 +393,7 @@ int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) Glib::ustring name; Glib::ustring extension; Glib::ustring profileName; - HaldCLUT::splitClutFilename (entry, name, extension, profileName); + HaldCLUT::splitClutFilename (entry, name, extension, profileName, false); extension = extension.casefold(); if (extension != "png" && extension != "tif") { From 357cf3a89efd8d6cfeb18c67aaa5a7b284fb4632 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 14 May 2019 00:23:10 +0200 Subject: [PATCH 05/10] Reduce memory allocations/deallocations and string copies when loading language files --- rtgui/multilangmgr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtgui/multilangmgr.cc b/rtgui/multilangmgr.cc index 8d2985436..298f5d2dd 100644 --- a/rtgui/multilangmgr.cc +++ b/rtgui/multilangmgr.cc @@ -179,7 +179,7 @@ void MultiLangMgr::load(const Glib::ustring &language, const std::vector Date: Tue, 14 May 2019 13:01:58 +0200 Subject: [PATCH 06/10] Remove StopWatch --- rtgui/filmsimulation.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/rtgui/filmsimulation.cc b/rtgui/filmsimulation.cc index dd29f1313..aee06f310 100644 --- a/rtgui/filmsimulation.cc +++ b/rtgui/filmsimulation.cc @@ -8,8 +8,6 @@ #include "../rtengine/clutstore.h" #include "../rtengine/procparams.h" -#define BENCHMARK -#include "../rtengine/StopWatch.h" using namespace rtengine; using namespace rtengine::procparams; @@ -307,7 +305,6 @@ ClutComboBox::ClutModel::ClutModel(const Glib::ustring &path) int ClutComboBox::ClutModel::parseDir(const Glib::ustring& path) { - BENCHFUNMICRO if (path.empty() || !Glib::file_test(path, Glib::FILE_TEST_IS_DIR)) { return 0; } From caeb171e0e9ad671ed69e619291a02299452ca99 Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 14 May 2019 22:08:02 +0200 Subject: [PATCH 07/10] Applied changes suggested by @Floessie, #5320 --- rtgui/adjuster.cc | 120 +++++++++++++++++++++++++++++++++++----------- rtgui/adjuster.h | 78 ++++++------------------------ 2 files changed, 106 insertions(+), 92 deletions(-) diff --git a/rtgui/adjuster.cc b/rtgui/adjuster.cc index f2ea3f0b4..0d2c2961f 100644 --- a/rtgui/adjuster.cc +++ b/rtgui/adjuster.cc @@ -25,16 +25,30 @@ #include "guiutils.h" #include "rtimage.h" -#define MIN_RESET_BUTTON_HEIGHT 17 namespace { + +constexpr int MIN_RESET_BUTTON_HEIGHT = 17; + double one2one(double val) { return val; } } -Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1, Gtk::Image *imgIcon2, double2double_fun slider2value_, double2double_fun value2slider_) : +Adjuster::Adjuster ( + Glib::ustring vlabel, + double vmin, + double vmax, + double vstep, + double vdefault, + Gtk::Image *imgIcon1, + Gtk::Image *imgIcon2, + double2double_fun slider2value, + double2double_fun value2slider) + + : + adjustmentName(std::move(vlabel)), grid(nullptr), label(nullptr), @@ -52,8 +66,8 @@ Adjuster::Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep logBase(0), logPivot(0), logAnchorMiddle(false), - value2slider(value2slider_ ? value2slider_ : one2one), - slider2value(slider2value_ ? slider2value_ : one2one), + value2slider(value2slider ? value2slider : &one2one), + slider2value(slider2value ? slider2value : &one2one), delay(options.adjusterMinDelay) { @@ -156,13 +170,12 @@ Adjuster::~Adjuster () delayConnection.block(true); adjusterListener = nullptr; - delete automatic; } -void Adjuster::addAutoButton (Glib::ustring tooltip) +void Adjuster::addAutoButton (const Glib::ustring &tooltip) { if (!automatic) { - automatic = new Gtk::CheckButton(); + automatic = Gtk::manage(new Gtk::CheckButton()); //automatic->add (*Gtk::manage (new RTImage ("gears.png"))); automatic->set_tooltip_markup(tooltip.length() ? Glib::ustring::compose("%1\n\n%2", M("GENERAL_AUTO"), tooltip) : M("GENERAL_AUTO")); setExpandAlignProperties(automatic, false, false, Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER); @@ -302,8 +315,8 @@ void Adjuster::resetPressed (GdkEventButton* event) double Adjuster::shapeValue (double a) const { - const double pow10 = pow(10.0, digits); - const double val = round(a * pow10) / pow10; + const double pow10 = std::pow(10.0, digits); + const double val = std::round(a * pow10) / pow10; return val == -0.0 ? 0.0 : val; } @@ -313,7 +326,7 @@ void Adjuster::setLimits (double vmin, double vmax, double vstep, double vdefaul spinChange.block(true); double pow10 = vstep; - for (digits = 0; fabs(pow10 - floor(pow10)) > 0.000000000001; digits++, pow10 *= 10.0); + for (digits = 0; std::fabs(pow10 - floor(pow10)) > 0.000000000001; digits++, pow10 *= 10.0); const double shapeVal = shapeValue(vdefault); spin->set_digits(digits); @@ -557,7 +570,6 @@ void Adjuster::showEditedCB () void Adjuster::editedToggled () { - if (adjusterListener && !blocked) { adjusterListener->adjusterChanged(this, spin->get_value()); } @@ -567,26 +579,20 @@ void Adjuster::editedToggled () void Adjuster::trimValue (double &val) const { - val = rtengine::LIM(val, vMin, vMax); - } void Adjuster::trimValue (int &val) const { - val = rtengine::LIM(val, vMin, vMax); - } void Adjuster::trimValue (float &val) const { - val = rtengine::LIM(val, vMin, vMax); - } -inline double Adjuster::getSliderValue() const +double Adjuster::getSliderValue() const { double val = slider->get_value(); if (logBase) { @@ -596,29 +602,28 @@ inline double Adjuster::getSliderValue() const if (val >= mmid) { double range = vMax - mmid; double x = (val - mmid) / range; - val = logPivot + (pow(logBase, x) - 1.0) / (logBase - 1.0) * (vMax - logPivot); + val = logPivot + (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * (vMax - logPivot); } else { double range = mmid - vMin; double x = (mmid - val) / range; - val = logPivot - (pow(logBase, x) - 1.0) / (logBase - 1.0) * (logPivot - vMin); + val = logPivot - (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * (logPivot - vMin); } } else { if (val >= logPivot) { double range = vMax - logPivot; double x = (val - logPivot) / range; - val = logPivot + (pow(logBase, x) - 1.0) / (logBase - 1.0) * range; + val = logPivot + (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * range; } else { double range = logPivot - vMin; double x = (logPivot - val) / range; - val = logPivot - (pow(logBase, x) - 1.0) / (logBase - 1.0) * range; + val = logPivot - (std::pow(logBase, x) - 1.0) / (logBase - 1.0) * range; } } } return val; } - -inline void Adjuster::setSliderValue(double val) +void Adjuster::setSliderValue(double val) { if (logBase) { if (logAnchorMiddle) { @@ -626,28 +631,27 @@ inline void Adjuster::setSliderValue(double val) if (val >= logPivot) { double range = vMax - logPivot; double x = (val - logPivot) / range; - val = (vMin + mid) + log(x * (logBase - 1.0) + 1.0) / log(logBase) * mid; + val = (vMin + mid) + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid; } else { double range = logPivot - vMin; double x = (logPivot - val) / range; - val = (vMin + mid) - log(x * (logBase - 1.0) + 1.0) / log(logBase) * mid; + val = (vMin + mid) - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * mid; } } else { if (val >= logPivot) { double range = vMax - logPivot; double x = (val - logPivot) / range; - val = logPivot + log(x * (logBase - 1.0) + 1.0) / log(logBase) * range; + val = logPivot + std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range; } else { double range = logPivot - vMin; double x = (logPivot - val) / range; - val = logPivot - log(x * (logBase - 1.0) + 1.0) / log(logBase) * range; + val = logPivot - std::log(x * (logBase - 1.0) + 1.0) / std::log(logBase) * range; } } } slider->set_value(val); } - void Adjuster::setLogScale(double base, double pivot, bool anchorMiddle) { spinChange.block(true); @@ -662,3 +666,61 @@ void Adjuster::setLogScale(double base, double pivot, bool anchorMiddle) sliderChange.block(false); spinChange.block(false); } + +bool Adjuster::getAutoValue() const +{ + return automatic ? automatic->get_active() : false; +} + +void Adjuster::setAutoInconsistent(bool i) +{ + if (automatic) { + automatic->set_inconsistent(i); + } +} + +bool Adjuster::getAutoInconsistent() const +{ + return automatic ? automatic->get_inconsistent() : true /* we have to return something */; +} + +void Adjuster::setAdjusterListener (AdjusterListener* alistener) +{ + adjusterListener = alistener; +} + +double Adjuster::getValue() const +{ + return shapeValue(spin->get_value()); +} + +int Adjuster::getIntValue() const +{ + return spin->get_value_as_int(); +} + +Glib::ustring Adjuster::getTextValue() const +{ + if (addMode) { + return Glib::ustring::compose("%1", spin->get_text()); + } else { + return spin->get_text(); + } +} + +void Adjuster::setLabel(const Glib::ustring &lbl) +{ + label->set_label(lbl); +} + +bool Adjuster::block(bool isBlocked) +{ + bool oldValue = blocked; + blocked = isBlocked; + return oldValue; +} + +bool Adjuster::getAddMode() const +{ + return addMode; +} diff --git a/rtgui/adjuster.h b/rtgui/adjuster.h index 2f3b10b18..f57129bf1 100644 --- a/rtgui/adjuster.h +++ b/rtgui/adjuster.h @@ -83,87 +83,40 @@ public: int delay; - Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1 = nullptr, Gtk::Image *imgIcon2 = nullptr, double2double_fun slider2value_ = nullptr, double2double_fun value2slider_ = nullptr); + Adjuster (Glib::ustring vlabel, double vmin, double vmax, double vstep, double vdefault, Gtk::Image *imgIcon1 = nullptr, Gtk::Image *imgIcon2 = nullptr, double2double_fun slider2value = nullptr, double2double_fun value2slider = nullptr); ~Adjuster () override; // Add an "Automatic" checkbox next to the reset button. - void addAutoButton(Glib::ustring tooltip = ""); + void addAutoButton(const Glib::ustring &tooltip = ""); // Send back the value of og the Auto checkbox - bool getAutoValue () - { - return automatic ? automatic->get_active() : false; - } - void setAutoValue (bool a); - bool notifyListenerAutoToggled (); - void autoToggled (); - void setAutoInconsistent (bool i) - { - if (automatic) { - automatic->set_inconsistent(i); - } - } - bool getAutoInconsistent () const - { - return automatic ? automatic->get_inconsistent() : true /* we have to return something */; - } - - void setAdjusterListener (AdjusterListener* alistener) - { - adjusterListener = alistener; - } - + bool getAutoValue() const; + void setAutoValue(bool a); + bool notifyListenerAutoToggled(); + void autoToggled(); + void setAutoInconsistent(bool i); + bool getAutoInconsistent() const; + void setAdjusterListener(AdjusterListener* alistener); // return the value trimmed to the limits at construction time - double getValue () const - { - return shapeValue(spin->get_value()); - } + double getValue() const; // return the value trimmed to the limits at construction time - int getIntValue () const - { - return spin->get_value_as_int(); - } + int getIntValue() const; // return the value trimmed to the limits at construction time, // method only used by the history manager, so decoration is added if addMode=true - Glib::ustring getTextValue () const - { - if (addMode) { - return Glib::ustring::compose("%1", spin->get_text()); - } else { - return spin->get_text(); - } - } - - void setLabel (const Glib::ustring &lbl) - { - label->set_label(lbl); - } + Glib::ustring getTextValue() const; + void setLabel (const Glib::ustring &lbl); void setValue (double a); void setLimits (double vmin, double vmax, double vstep, double vdefault); void setEnabled (bool enabled); void setDefault (double def); // will let the adjuster throw it's "changed" signal when the mouse button is released. Can work altogether with the delay value. void throwOnButtonRelease(bool throwOnBRelease = true); - void setNbDisplayedChars (int nbr) - { - spin->set_width_chars(nbr); - spin->set_max_width_chars(nbr); - } void setEditedState (EditedState eState); EditedState getEditedState (); void setDefaultEditedState (EditedState eState); void showEditedCB (); - bool block(bool isBlocked) - { - bool oldValue = blocked; - blocked = isBlocked; - return oldValue; - } - + bool block(bool isBlocked); void setAddMode(bool addM); - bool getAddMode() const - { - return addMode; - }; + bool getAddMode() const; void spinChanged (); void sliderChanged (); bool notifyListener (); @@ -175,7 +128,6 @@ public: void trimValue (double &val) const; void trimValue (float &val) const; void trimValue (int &val) const; - void setLogScale(double base, double pivot, bool anchorMiddle = false); }; From efe9ff5ae3bfcf720a47d3741d5a5e7bdf944ddc Mon Sep 17 00:00:00 2001 From: heckflosse Date: Tue, 14 May 2019 22:53:22 +0200 Subject: [PATCH 08/10] Don't show 1:1 icon on raw tools when using demosaic for < 1:1 view == as in pp3 --- rtgui/bayerpreprocess.cc | 2 +- rtgui/bayerprocess.cc | 2 +- rtgui/bayerrawexposure.cc | 2 +- rtgui/preprocess.cc | 2 +- rtgui/xtransprocess.cc | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rtgui/bayerpreprocess.cc b/rtgui/bayerpreprocess.cc index 44be0d047..35f36e83e 100644 --- a/rtgui/bayerpreprocess.cc +++ b/rtgui/bayerpreprocess.cc @@ -28,7 +28,7 @@ using namespace rtengine; using namespace rtengine::procparams; -BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), true) +BayerPreProcess::BayerPreProcess() : FoldableToolPanel(this, "bayerpreprocess", M("TP_PREPROCESS_LABEL"), options.prevdemo != PD_Sidecar) { auto m = ProcEventMapper::getInstance(); EvLineDenoiseDirection = m->newEvent(DARKFRAME, "HISTORY_MSG_PREPROCESS_LINEDENOISE_DIRECTION"); diff --git a/rtgui/bayerprocess.cc b/rtgui/bayerprocess.cc index a681023a6..6f38f4c43 100644 --- a/rtgui/bayerprocess.cc +++ b/rtgui/bayerprocess.cc @@ -28,7 +28,7 @@ using namespace rtengine; using namespace rtengine::procparams; -BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RAW_LABEL"), true) +BayerProcess::BayerProcess () : FoldableToolPanel(this, "bayerprocess", M("TP_RAW_LABEL"), options.prevdemo != PD_Sidecar) { auto m = ProcEventMapper::getInstance(); diff --git a/rtgui/bayerrawexposure.cc b/rtgui/bayerrawexposure.cc index 86cd9794b..73c96bcf1 100644 --- a/rtgui/bayerrawexposure.cc +++ b/rtgui/bayerrawexposure.cc @@ -26,7 +26,7 @@ using namespace rtengine; using namespace rtengine::procparams; -BayerRAWExposure::BayerRAWExposure () : FoldableToolPanel(this, "bayerrawexposure", M("TP_EXPOS_BLACKPOINT_LABEL"), true) +BayerRAWExposure::BayerRAWExposure () : FoldableToolPanel(this, "bayerrawexposure", M("TP_EXPOS_BLACKPOINT_LABEL"), options.prevdemo != PD_Sidecar) { PexBlack1 = Gtk::manage(new Adjuster (M("TP_RAWEXPOS_BLACK_1"), -2048, 2048, 0.1, 0)); //black level PexBlack1->setAdjusterListener (this); diff --git a/rtgui/preprocess.cc b/rtgui/preprocess.cc index 65646dea3..92cd06bc1 100644 --- a/rtgui/preprocess.cc +++ b/rtgui/preprocess.cc @@ -28,7 +28,7 @@ using namespace rtengine; using namespace rtengine::procparams; -PreProcess::PreProcess () : FoldableToolPanel(this, "preprocess", M("TP_PREPROCESS_LABEL"), true) +PreProcess::PreProcess () : FoldableToolPanel(this, "preprocess", M("TP_PREPROCESS_LABEL"), options.prevdemo != PD_Sidecar) { Gtk::HBox* hotdeadPixel = Gtk::manage( new Gtk::HBox () ); diff --git a/rtgui/xtransprocess.cc b/rtgui/xtransprocess.cc index e98394735..115fa3868 100644 --- a/rtgui/xtransprocess.cc +++ b/rtgui/xtransprocess.cc @@ -27,7 +27,7 @@ using namespace rtengine; using namespace rtengine::procparams; -XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), true) +XTransProcess::XTransProcess () : FoldableToolPanel(this, "xtransprocess", M("TP_RAW_LABEL"), options.prevdemo != PD_Sidecar) { auto m = ProcEventMapper::getInstance(); EvDemosaicBorder = m->newEvent(DEMOSAIC, "HISTORY_MSG_RAW_BORDER"); From 00b007f47ac4e52a86466e5492fa5ef988189bca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Thu, 16 May 2019 10:28:13 +0200 Subject: [PATCH 09/10] Fix compiler warning for non-SSE2 builds --- rtengine/improcfun.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index d215833d3..6ce7175d1 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -2518,13 +2518,13 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer } } } else { - float tmpr[4] ALIGNED16; - float tmpg[4] ALIGNED16; - float tmpb[4] ALIGNED16; - for (int i = istart, ti = 0; i < tH; i++, ti++) { int j = jstart, tj = 0; #ifdef __SSE2__ + float tmpr[4] ALIGNED16; + float tmpg[4] ALIGNED16; + float tmpb[4] ALIGNED16; + for (; j < tW - 3; j+=4, tj+=4) { //brightness/contrast STVF(tmpr[0], tonecurve(LVF(rtemp[ti * TS + tj]))); From 351f8f4e12919bb26ec9ad3fc226fd5d79c57ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Thu, 16 May 2019 10:33:07 +0200 Subject: [PATCH 10/10] Fix indentation --- rtengine/improcfun.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rtengine/improcfun.cc b/rtengine/improcfun.cc index 6ce7175d1..f63313126 100644 --- a/rtengine/improcfun.cc +++ b/rtengine/improcfun.cc @@ -2521,9 +2521,9 @@ void ImProcFunctions::rgbProc (Imagefloat* working, LabImage* lab, PipetteBuffer for (int i = istart, ti = 0; i < tH; i++, ti++) { int j = jstart, tj = 0; #ifdef __SSE2__ - float tmpr[4] ALIGNED16; - float tmpg[4] ALIGNED16; - float tmpb[4] ALIGNED16; + float tmpr[4] ALIGNED16; + float tmpg[4] ALIGNED16; + float tmpb[4] ALIGNED16; for (; j < tW - 3; j+=4, tj+=4) { //brightness/contrast