merge with dev

This commit is contained in:
Desmis 2019-09-06 11:10:24 +02:00
commit 0c8a31f6b8
9 changed files with 31 additions and 23 deletions

View File

@ -1483,7 +1483,6 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
delete labView; delete labView;
delete baseImg; delete baseImg;
/*
// calculate scale // calculate scale
if (params.coarse.rotate == 90 || params.coarse.rotate == 270) { if (params.coarse.rotate == 90 || params.coarse.rotate == 270) {
myscale = scale * thumbImg->getWidth() / fh; myscale = scale * thumbImg->getWidth() / fh;
@ -1495,17 +1494,19 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, eSensorT
// apply crop // apply crop
if (params.crop.enabled) { if (params.crop.enabled) {
int ix = 0; int ix = 0;
for (int i=0; i<fh; i++) for (int i = 0; i < fh; ++i) {
for (int j=0; j<fw; j++) 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) { 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; readyImg->data[ix++] /= 3;
readyImg->data[ix++] /= 3; readyImg->data[ix++] /= 3;
} } else {
else
ix += 3; ix += 3;
}
}
}
} }
*/
return readyImg; return readyImg;
} }

View File

@ -2475,6 +2475,18 @@ bool Options::has_retained_extention(const Glib::ustring& fname)
return parsedExtensionsSet.find(getExtension(fname).lowercase()) != parsedExtensionsSet.end(); 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<std::string> 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 * return true if ext is an enabled extension
*/ */

View File

@ -426,6 +426,7 @@ public:
Glib::ustring findProfilePath (Glib::ustring &profName); Glib::ustring findProfilePath (Glib::ustring &profName);
bool is_parse_extention (Glib::ustring fname); bool is_parse_extention (Glib::ustring fname);
bool has_retained_extention (const 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_extention_enabled (const Glib::ustring& ext);
bool is_defProfRawMissing(); bool is_defProfRawMissing();
bool is_bundledDefProfRawMissing(); bool is_bundledDefProfRawMissing();

View File

@ -169,7 +169,7 @@ void RTImage::init()
scaleBack = RTScalable::getScale(); scaleBack = RTScalable::getScale();
} }
void RTImage::cleanup() void RTImage::cleanup(bool all)
{ {
for (auto& entry : pixbufCache) { for (auto& entry : pixbufCache) {
entry.second.reset(); entry.second.reset();
@ -177,7 +177,7 @@ void RTImage::cleanup()
for (auto& entry : surfaceCache) { for (auto& entry : surfaceCache) {
entry.second.clear(); entry.second.clear();
} }
RTScalable::cleanup(); RTScalable::cleanup(all);
} }
void RTImage::updateImages() void RTImage::updateImages()

View File

@ -52,7 +52,7 @@ public:
static void init(); static void init();
static void cleanup(); static void cleanup(bool all = false);
static void updateImages (); static void updateImages ();
static void setDPInScale (const double newDPI, const int newScale); static void setDPInScale (const double newDPI, const int newScale);
static void setScale (const int newScale); static void setScale (const int newScale);

View File

@ -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 imagesCacheFolder = Glib::build_filename (options.cacheBaseDir, "svg2png");
Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI()); Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI());
@ -134,7 +134,7 @@ void RTScalable::cleanup()
continue; continue;
} }
if (fileName != sDPI) { if (all || fileName != sDPI) {
deleteDir(filePath); deleteDir(filePath);
} }
} }

View File

@ -50,7 +50,7 @@ public:
#endif #endif
static void init(Gtk::Window *window); static void init(Gtk::Window *window);
static void cleanup(); static void cleanup(bool all = false);
static double getDPI (); 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 double getTweakedDPI (); // The returned value is tweaked DPI to adapt to main the font size. Maybe not an ideal solution.
static int getScale (); static int getScale ();

View File

@ -95,6 +95,9 @@ RTWindow::RTWindow ()
, fpanel (nullptr) , fpanel (nullptr)
{ {
if (options.is_new_version()) {
RTImage::cleanup(true);
}
cacheMgr->init (); cacheMgr->init ();
ProfilePanel::init (this); ProfilePanel::init (this);
@ -475,16 +478,8 @@ void RTWindow::on_realize ()
mainWindowCursorManager.init (get_window()); mainWindowCursorManager.init (get_window());
// Display release notes only if new major version. // 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<std::string> vMajor;
for (const auto& v : vs) {
vMajor.emplace_back(v, 0, v.find_first_not_of("0123456789."));
}
bool waitForSplash = false; bool waitForSplash = false;
if (vMajor.size() == 2 && vMajor[0] != vMajor[1]) { if (options.is_new_version()) {
// Update the version parameter with the right value // Update the version parameter with the right value
options.version = versionString; options.version = versionString;

View File

@ -53,7 +53,6 @@ private:
{ {
return !options.tabbedUI && ! (options.multiDisplayMode > 0); return !options.tabbedUI && ! (options.multiDisplayMode > 0);
}; };
void findVerNumbers (int* numbers, Glib::ustring versionStr);
bool on_expose_event_epanel (GdkEventExpose* event); bool on_expose_event_epanel (GdkEventExpose* event);
bool on_expose_event_fpanel (GdkEventExpose* event); bool on_expose_event_fpanel (GdkEventExpose* event);