diff --git a/rtengine/rtthumbnail.cc b/rtengine/rtthumbnail.cc index 1ffaf939a..3e970ed0d 100644 --- a/rtengine/rtthumbnail.cc +++ b/rtengine/rtthumbnail.cc @@ -1483,7 +1483,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT delete labView; delete baseImg; - /* // calculate scale if (params.coarse.rotate == 90 || params.coarse.rotate == 270) { myscale = scale * thumbImg->getWidth() / fh; @@ -1495,17 +1494,19 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT // apply crop if (params.crop.enabled) { int ix = 0; - for (int i=0; i(params.crop.y+params.crop.h)/myscale || j(params.crop.x+params.crop.w)/myscale) { + for (int i = 0; i < fh; ++i) { + for (int j = 0; j < fw; ++j) { + if (i < params.crop.y * myscale || i > (params.crop.y + params.crop.h) * myscale || j < params.crop.x * myscale || j > (params.crop.x + params.crop.w) * myscale) { readyImg->data[ix++] /= 3; readyImg->data[ix++] /= 3; readyImg->data[ix++] /= 3; - } - else + } else { ix += 3; + } + } + } } - */ + return readyImg; } diff --git a/rtgui/options.cc b/rtgui/options.cc index 640aa0243..b667f8679 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -2475,6 +2475,18 @@ bool Options::has_retained_extention(const Glib::ustring& fname) return parsedExtensionsSet.find(getExtension(fname).lowercase()) != parsedExtensionsSet.end(); } +// Pattern matches "5.1" from "5.1-23-g12345678", when comparing option.version to RTVERSION +bool Options::is_new_version() { + const std::string vs[] = {versionString, version}; + std::vector vMajor; + + for (const auto& v : vs) { + vMajor.emplace_back(v, 0, v.find_first_not_of("0123456789.")); + } + + return vMajor.size() == 2 && vMajor[0] != vMajor[1]; +} + /* * return true if ext is an enabled extension */ diff --git a/rtgui/options.h b/rtgui/options.h index d1d14a11f..0c580b034 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -426,6 +426,7 @@ public: Glib::ustring findProfilePath (Glib::ustring &profName); bool is_parse_extention (Glib::ustring fname); bool has_retained_extention (const Glib::ustring& fname); + bool is_new_version(); bool is_extention_enabled (const Glib::ustring& ext); bool is_defProfRawMissing(); bool is_bundledDefProfRawMissing(); diff --git a/rtgui/rtimage.cc b/rtgui/rtimage.cc index 3fdf743f5..5ae3e4ddb 100644 --- a/rtgui/rtimage.cc +++ b/rtgui/rtimage.cc @@ -169,7 +169,7 @@ void RTImage::init() scaleBack = RTScalable::getScale(); } -void RTImage::cleanup() +void RTImage::cleanup(bool all) { for (auto& entry : pixbufCache) { entry.second.reset(); @@ -177,7 +177,7 @@ void RTImage::cleanup() for (auto& entry : surfaceCache) { entry.second.clear(); } - RTScalable::cleanup(); + RTScalable::cleanup(all); } void RTImage::updateImages() diff --git a/rtgui/rtimage.h b/rtgui/rtimage.h index 244d0030a..15978f65c 100644 --- a/rtgui/rtimage.h +++ b/rtgui/rtimage.h @@ -52,7 +52,7 @@ public: static void init(); - static void cleanup(); + static void cleanup(bool all = false); static void updateImages (); static void setDPInScale (const double newDPI, const int newScale); static void setScale (const int newScale); diff --git a/rtgui/rtscalable.cc b/rtgui/rtscalable.cc index 079ece8d2..ae3214520 100644 --- a/rtgui/rtscalable.cc +++ b/rtgui/rtscalable.cc @@ -119,7 +119,7 @@ void RTScalable::deleteDir(const Glib::ustring& path) } } -void RTScalable::cleanup() +void RTScalable::cleanup(bool all) { Glib::ustring imagesCacheFolder = Glib::build_filename (options.cacheBaseDir, "svg2png"); Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI()); @@ -134,7 +134,7 @@ void RTScalable::cleanup() continue; } - if (fileName != sDPI) { + if (all || fileName != sDPI) { deleteDir(filePath); } } diff --git a/rtgui/rtscalable.h b/rtgui/rtscalable.h index e6180eaa1..b8db9953c 100644 --- a/rtgui/rtscalable.h +++ b/rtgui/rtscalable.h @@ -50,7 +50,7 @@ public: #endif static void init(Gtk::Window *window); - static void cleanup(); + static void cleanup(bool all = false); static double getDPI (); static double getTweakedDPI (); // The returned value is tweaked DPI to adapt to main the font size. Maybe not an ideal solution. static int getScale (); diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index 85b902727..131016cb0 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -95,6 +95,9 @@ RTWindow::RTWindow () , fpanel (nullptr) { + if (options.is_new_version()) { + RTImage::cleanup(true); + } cacheMgr->init (); ProfilePanel::init (this); @@ -475,16 +478,8 @@ void RTWindow::on_realize () mainWindowCursorManager.init (get_window()); // Display release notes only if new major version. - // Pattern matches "5.1" from "5.1-23-g12345678" - const std::string vs[] = {versionString, options.version}; - std::vector vMajor; - - for (const auto& v : vs) { - vMajor.emplace_back(v, 0, v.find_first_not_of("0123456789.")); - } - bool waitForSplash = false; - if (vMajor.size() == 2 && vMajor[0] != vMajor[1]) { + if (options.is_new_version()) { // Update the version parameter with the right value options.version = versionString; diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index d037d8875..48662858f 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -53,7 +53,6 @@ private: { return !options.tabbedUI && ! (options.multiDisplayMode > 0); }; - void findVerNumbers (int* numbers, Glib::ustring versionStr); bool on_expose_event_epanel (GdkEventExpose* event); bool on_expose_event_fpanel (GdkEventExpose* event);