diff --git a/rtengine/histmatching.cc b/rtengine/histmatching.cc index 3d1eb1657..f91086285 100644 --- a/rtengine/histmatching.cc +++ b/rtengine/histmatching.cc @@ -289,7 +289,10 @@ void RawImageSource::getAutoMatchedToneCurve(const ColorManagementParams &cp, st histMatchingCache = outCurve; *histMatchingParams = cp; return; - } else if (w * 32 < fw) { + } else if (w * 33 < fw || w * h < 19200) { + // Some cameras have extremely small thumbs, for example Canon PowerShot A3100 IS has 128x96 thumbs. + // For them we skip histogram matching. + // With 160x120 thumbs from RICOH GR DIGITAL 2 it works fine, so we use 19200 as limit. if (settings->verbose) { std::cout << "histogram matching: the embedded thumbnail is too small: " << w << "x" << h << std::endl; } diff --git a/rtgui/edit.cc b/rtgui/edit.cc index eb91d3fda..c59c2dc04 100644 --- a/rtgui/edit.cc +++ b/rtgui/edit.cc @@ -896,7 +896,7 @@ void OPIcon::drawImage(Cairo::RefPtr &img, rtengine::Coord tl, br; // Coordinate of the rectangle in the CropBuffer coordinate system drivenPointToRectangle(pos, tl, br, imgW, imgH); - cr->set_source(img->surface, tl.x, tl.y); + cr->set_source(img->get(), tl.x, tl.y); cr->set_line_width(0.); cr->rectangle(tl.x, tl.y, imgW, imgH); cr->fill(); diff --git a/rtgui/lwbutton.cc b/rtgui/lwbutton.cc index b1ed940c2..48843a02e 100644 --- a/rtgui/lwbutton.cc +++ b/rtgui/lwbutton.cc @@ -205,7 +205,7 @@ void LWButton::redraw (Cairo::RefPtr context) } if (icon) { - context->set_source (icon->surface, xpos + dilat, ypos + dilat); + context->set_source (icon->get(), xpos + dilat, ypos + dilat); context->paint (); } } diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index ddd42eb6a..cbea1d477 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -28,15 +28,17 @@ #include #include #include -#include "rtwindow.h" #include #include #include +#include "../rtengine/procparams.h" +#include "../rtengine/profilestore.h" #include "options.h" #include "soundman.h" #include "rtimage.h" #include "version.h" #include "extprog.h" +#include "pathutils.h" #ifndef WIN32 #include @@ -44,6 +46,8 @@ #include #include #else +#include +#include #include #include "conio.h" #endif diff --git a/rtgui/rtsurface.cc b/rtgui/rtsurface.cc index faf1a750d..9f692878d 100644 --- a/rtgui/rtsurface.cc +++ b/rtgui/rtsurface.cc @@ -132,3 +132,8 @@ bool RTSurface::hasSurface() const { return surface ? true : false; } + +const Cairo::RefPtr& RTSurface::get() const +{ + return surface; +} diff --git a/rtgui/rtsurface.h b/rtgui/rtsurface.h index 58093d323..d55506269 100644 --- a/rtgui/rtsurface.h +++ b/rtgui/rtsurface.h @@ -26,12 +26,15 @@ */ class RTSurface : public RTScalable { + +private: + static double dpiBack; // used to keep track of master dpi change static int scaleBack; // used to keep track of master scale change + Cairo::RefPtr surface; void changeImage (Glib::ustring imageName); public: - Cairo::RefPtr surface; RTSurface (); RTSurface (const RTSurface& other); @@ -42,6 +45,8 @@ public: int getHeight() const; bool hasSurface() const; + const Cairo::RefPtr& get() const; + static void init(); static void updateImages (); static void setDPInScale (const double newDPI, const int newScale);