diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index 8bc5362fd..d252b501f 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -52,7 +52,6 @@ namespace // Opens a file for binary writing and request exclusive lock (cases were you need "wb" mode plus locking) FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname) { - FILE* f = nullptr; #ifdef WIN32 @@ -61,6 +60,7 @@ FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname) std::unique_ptr wfname (reinterpret_cast(g_utf8_to_utf16 (fname.c_str (), -1, NULL, NULL, NULL)), g_free); HANDLE hFile = CreateFileW ( wfname.get (), GENERIC_READ | GENERIC_WRITE, 0 /* no sharing allowed */, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + FILE* f = nullptr; if (hFile != INVALID_HANDLE_VALUE) { f = _fdopen (_open_osfhandle ((intptr_t)hFile, 0), "wb"); @@ -68,7 +68,7 @@ FILE* g_fopen_withBinaryAndLock(const Glib::ustring& fname) #else - f = ::g_fopen (fname.c_str (), "wb"); + FILE* f = ::g_fopen (fname.c_str (), "wb"); #endif diff --git a/rtengine/imagesource.h b/rtengine/imagesource.h index b1de9d31f..0eec1325a 100644 --- a/rtengine/imagesource.h +++ b/rtengine/imagesource.h @@ -70,8 +70,8 @@ public: virtual void preprocess (const RAWParams &raw, const LensProfParams &lensProf, const CoarseTransformParams& coarse, bool prepareDenoise = true) {}; virtual void demosaic (const RAWParams &raw) {}; virtual void retinex (ColorManagementParams cmp, const RetinexParams &deh, ToneCurveParams Tc, LUTf & cdcurve, LUTf & mapcurve, const RetinextransmissionCurve & dehatransmissionCurve, const RetinexgaintransmissionCurve & dehagaintransmissionCurve, multi_array2D &conversionBuffer, bool dehacontlutili, bool mapcontlutili, bool useHsl, float &minCD, float &maxCD, float &mini, float &maxi, float &Tmean, float &Tsigma, float &Tmin, float &Tmax, LUTu &histLRETI) {}; - virtual void retinexPrepareCurves (RetinexParams retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; - virtual void retinexPrepareBuffers (ColorManagementParams cmp, RetinexParams retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; + virtual void retinexPrepareCurves (const RetinexParams &retinexParams, LUTf &cdcurve, LUTf &mapcurve, RetinextransmissionCurve &retinextransmissionCurve, RetinexgaintransmissionCurve &retinexgaintransmissionCurve, bool &retinexcontlutili, bool &mapcontlutili, bool &useHsl, LUTu & lhist16RETI, LUTu & histLRETI) {}; + virtual void retinexPrepareBuffers (ColorManagementParams cmp, const RetinexParams &retinexParams, multi_array2D &conversionBuffer, LUTu &lhist16RETI) {}; virtual void flushRawData () {}; virtual void flushRGB () {}; virtual void HLRecovery_Global (ToneCurveParams hrp) {}; diff --git a/rtengine/ipvibrance.cc b/rtengine/ipvibrance.cc index 49f956602..68efd1aea 100644 --- a/rtengine/ipvibrance.cc +++ b/rtengine/ipvibrance.cc @@ -78,8 +78,7 @@ void ImProcFunctions::vibrance (LabImage* lab) // int skip=1; //scale==1 ? 1 : 16; bool skinCurveIsSet = false; - DiagonalCurve* dcurve = nullptr; - dcurve = new DiagonalCurve (params->vibrance.skintonescurve, CURVES_MIN_POLY_POINTS); + DiagonalCurve* dcurve = new DiagonalCurve (params->vibrance.skintonescurve, CURVES_MIN_POLY_POINTS); if (dcurve) { if (!dcurve->isIdentity()) { diff --git a/rtengine/ipwavelet.cc b/rtengine/ipwavelet.cc index f5cb63b07..f1f9a53e5 100644 --- a/rtengine/ipwavelet.cc +++ b/rtengine/ipwavelet.cc @@ -923,9 +923,8 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int ind = 1; //Flat curve for Contrast=f(H) in levels - FlatCurve* ChCurve = nullptr;//curve C=f(H) + FlatCurve* ChCurve = new FlatCurve(params->wavelet.Chcurve); //curve C=f(H) bool Chutili = false; - ChCurve = new FlatCurve(params->wavelet.Chcurve); if (!ChCurve || ChCurve->isIdentity()) { if (ChCurve) { @@ -953,9 +952,8 @@ SSEFUNCTION void ImProcFunctions::ip_wavelet(LabImage * lab, LabImage * dst, int } //Flat curve for H=f(H) in residual image - FlatCurve* hhCurve = nullptr;//curve H=f(H) + FlatCurve* hhCurve = new FlatCurve(params->wavelet.hhcurve); //curve H=f(H) bool hhutili = false; - hhCurve = new FlatCurve(params->wavelet.hhcurve); if (!hhCurve || hhCurve->isIdentity()) { if (hhCurve) { diff --git a/rtengine/rawimagesource.cc b/rtengine/rawimagesource.cc index df803d951..3c16163e5 100644 --- a/rtengine/rawimagesource.cc +++ b/rtengine/rawimagesource.cc @@ -2210,7 +2210,7 @@ void RawImageSource::retinexPrepareBuffers(ColorManagementParams cmp, const Reti } } */ - if(retinexParams.gammaretinex != "none" && retinexParams.str != 0) {//gamma + if(retinexParams.gammaretinex != "none" && retinexParams.str != 0 && retinexgamtab) {//gamma #ifdef _OPENMP #pragma omp parallel for @@ -5005,7 +5005,7 @@ void RawImageSource::getAutoWBMultipliers (double &rm, double &gm, double &bm) } if( settings->verbose ) { - printf ("AVG: %g %g %g\n", avg_r / rn, avg_g / gn, avg_b / bn); + printf ("AVG: %g %g %g\n", avg_r / std::max(1, rn), avg_g / std::max(1, gn), avg_b / std::max(1, bn)); } // return ColorTemp (pow(avg_r/rn, 1.0/6.0)*img_r, pow(avg_g/gn, 1.0/6.0)*img_g, pow(avg_b/bn, 1.0/6.0)*img_b); @@ -5134,9 +5134,9 @@ ColorTemp RawImageSource::getSpotWB (std::vector &red, std::vector &red, std::vectorpanelChanged (EvNeutralBW, M("ADJUSTER_RESET_TO_DEFAULT")); + if(listener) { + listener->panelChanged (EvNeutralBW, M("ADJUSTER_RESET_TO_DEFAULT")); + } } void BlackWhite::enabledcc_toggled () diff --git a/rtgui/coordinateadjuster.cc b/rtgui/coordinateadjuster.cc index 23d4d79d7..ac8e5ea4e 100644 --- a/rtgui/coordinateadjuster.cc +++ b/rtgui/coordinateadjuster.cc @@ -123,10 +123,9 @@ void CoordinateAdjuster::createWidgets(const std::vector &axis) axisAdjusters.resize(axis.size()); for (unsigned int i = 0; i < count; ++i) { - AxisAdjuster *currAdjuster = nullptr; const Axis *currAxis = &(axis.at(i)); axisAdjusters.at(i) = new AxisAdjuster(this, currAxis, i); - currAdjuster = axisAdjusters.at(i); + AxisAdjuster *currAdjuster = axisAdjusters.at(i); currAdjuster->rangeLowerBound = currAxis->rangeLowerBound; currAdjuster->rangeUpperBound = currAxis->rangeUpperBound; diff --git a/rtgui/crophandler.cc b/rtgui/crophandler.cc index 6d6e9c42f..f6ff83a7d 100644 --- a/rtgui/crophandler.cc +++ b/rtgui/crophandler.cc @@ -545,6 +545,7 @@ void CropHandler::colorPick (const rtengine::Coord &pickerPos, float &r, float & } } + count = std::max(1u, count); // Averaging r = (float)r2 / (float)count / 255.f; g = (float)g2 / (float)count / 255.f; @@ -569,6 +570,8 @@ void CropHandler::colorPick (const rtengine::Coord &pickerPos, float &r, float & } } } + + count = std::max(1u, count); // Averaging rpreview = (float)r2 / (float)count / 255.f; gpreview = (float)g2 / (float)count / 255.f; diff --git a/rtgui/edit.cc b/rtgui/edit.cc index 476cd3602..9ee0d63ba 100644 --- a/rtgui/edit.cc +++ b/rtgui/edit.cc @@ -822,7 +822,7 @@ OPIcon::OPIcon(const Cairo::RefPtr &normal, } if (dragged) { - draggedImg = active; + draggedImg = dragged; } if (insensitive) { diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index b67fef8bd..a334c84a8 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -212,10 +212,12 @@ private: spGamutCheck.show (); } +#if !defined(__APPLE__) void profileBoxChanged () { updateParameters (); } +#endif void intentBoxChanged (int) { diff --git a/rtgui/histogrampanel.cc b/rtgui/histogrampanel.cc index 45076208b..002c4608b 100644 --- a/rtgui/histogrampanel.cc +++ b/rtgui/histogrampanel.cc @@ -1179,6 +1179,7 @@ void HistogramArea::drawCurve(Cairo::RefPtr &cr, LUTu & data, double scale, int hsize, int vsize) { cr->move_to (0, vsize - 1); + scale = scale <= 0.f ? 0.001f : scale; // avoid division by zero and negative values for (int i = 0; i < 256; i++) { double val = data[i] * (double)(vsize - 2) / scale; diff --git a/rtgui/resize.cc b/rtgui/resize.cc index bf2d4ce67..1a87bbe8c 100644 --- a/rtgui/resize.cc +++ b/rtgui/resize.cc @@ -29,14 +29,13 @@ Resize::Resize () : FoldableToolPanel(this, "resize", M("TP_RESIZE_LABEL"), fals croph = 0; Gtk::Table* combos = Gtk::manage (new Gtk::Table (2, 2)); - Gtk::Label *label = nullptr; appliesTo = Gtk::manage (new MyComboBoxText ()); appliesTo->append (M("TP_RESIZE_CROPPEDAREA")); appliesTo->append (M("TP_RESIZE_FULLIMAGE")); appliesTo->set_active (0); - label = Gtk::manage (new Gtk::Label (M("TP_RESIZE_APPLIESTO"))); + Gtk::Label *label = Gtk::manage (new Gtk::Label (M("TP_RESIZE_APPLIESTO"))); label->set_alignment(0., 0.); combos->attach (*label, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 2, 2); combos->attach (*appliesTo, 1, 2, 0, 1, Gtk::EXPAND | Gtk::FILL, Gtk::SHRINK, 2, 2); diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index b5fa6c21f..d6c2acd9d 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -25,7 +25,7 @@ using namespace std; ThumbBrowserBase::ThumbBrowserBase () - : location(THLOC_FILEBROWSER), inspector(nullptr), isInspectorActive(false), eventTime(0), lastClicked(nullptr), previewHeight(options.thumbSize), numOfCols(1) + : location(THLOC_FILEBROWSER), inspector(nullptr), isInspectorActive(false), eventTime(0), lastClicked(nullptr), previewHeight(options.thumbSize), numOfCols(1), arrangement(TB_Horizontal) { inW = -1; inH = -1;