Second and last part of issue 898 bugfix : Thumbnails aren't updated when toggling "Info" on/off
This patch also solve the skewed thumbnails bug Credits: Oduis / Hombre
This commit is contained in:
@@ -780,14 +780,17 @@ IImage8* Thumbnail::processImage (const procparams::ProcParams& params, int rhei
|
|||||||
return readyImg;
|
return readyImg;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Thumbnail::getImageWidth (const procparams::ProcParams& params, int rheight) {
|
int Thumbnail::getImageWidth (const procparams::ProcParams& params, int rheight, float &ratio) {
|
||||||
if (thumbImg==NULL) return 0; // Can happen if thumb is just building and GUI comes in with resize wishes
|
if (thumbImg==NULL) return 0; // Can happen if thumb is just building and GUI comes in with resize wishes
|
||||||
|
|
||||||
int rwidth;
|
int rwidth;
|
||||||
if (params.coarse.rotate==90 || params.coarse.rotate==270)
|
if (params.coarse.rotate==90 || params.coarse.rotate==270) {
|
||||||
rwidth = thumbImg->height * rheight / thumbImg->width;
|
ratio = (float)(thumbImg->height) / (float)(thumbImg->width);
|
||||||
else
|
}
|
||||||
rwidth = thumbImg->width * rheight / thumbImg->height;
|
else {
|
||||||
|
ratio = (float)(thumbImg->width) / (float)(thumbImg->height);
|
||||||
|
}
|
||||||
|
rwidth = (int)(ratio * (float)rheight);
|
||||||
|
|
||||||
return rwidth;
|
return rwidth;
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ namespace rtengine {
|
|||||||
|
|
||||||
IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale);
|
IImage8* processImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale);
|
||||||
IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale);
|
IImage8* quickProcessImage (const procparams::ProcParams& pparams, int rheight, TypeInterpolation interp, double& scale);
|
||||||
int getImageWidth (const procparams::ProcParams& pparams, int rheight);
|
int getImageWidth (const procparams::ProcParams& pparams, int rheight, float &ratio);
|
||||||
void getDimensions (int& w, int& h, double& scaleFac);
|
void getDimensions (int& w, int& h, double& scaleFac);
|
||||||
|
|
||||||
static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate);
|
static Thumbnail* loadQuickFromRaw (const Glib::ustring& fname, rtengine::RawMetaDataLocation& rml, int &w, int &h, int fixwh, bool rotate);
|
||||||
|
@@ -91,7 +91,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// draw preview frame
|
// draw preview frame
|
||||||
backBuffer->draw_rectangle (gc_, false, (exp_width-prew)/2, upperMargin+bsHeight, prew+1, preh+1);
|
//backBuffer->draw_rectangle (gc_, false, (exp_width-prew)/2, upperMargin+bsHeight, prew+1, preh+1);
|
||||||
// draw thumbnail image
|
// draw thumbnail image
|
||||||
if (preview) {
|
if (preview) {
|
||||||
prex = borderWidth + (exp_width-prew)/2;
|
prex = borderWidth + (exp_width-prew)/2;
|
||||||
@@ -296,7 +296,9 @@ void ThumbBrowserEntryBase::resize (int h) {
|
|||||||
delete [] preview;
|
delete [] preview;
|
||||||
preview = NULL;
|
preview = NULL;
|
||||||
refreshThumbnailImage ();
|
refreshThumbnailImage ();
|
||||||
} // causes skewed thumb sometimes: else updateBackBuffer();
|
}
|
||||||
|
else
|
||||||
|
updateBackBuffer();
|
||||||
|
|
||||||
drawable = true;
|
drawable = true;
|
||||||
}
|
}
|
||||||
|
@@ -85,6 +85,7 @@ void Thumbnail::_generateThumbnailImage () {
|
|||||||
lastImg = NULL;
|
lastImg = NULL;
|
||||||
tw = -1;
|
tw = -1;
|
||||||
th = options.maxThumbnailHeight;
|
th = options.maxThumbnailHeight;
|
||||||
|
imgRatio = -1.;
|
||||||
|
|
||||||
// generate thumbnail image
|
// generate thumbnail image
|
||||||
Glib::ustring ext = getExtension (fname);
|
Glib::ustring ext = getExtension (fname);
|
||||||
@@ -388,8 +389,13 @@ void Thumbnail::getThumbnailSize (int &w, int &h) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
w=0;
|
w=0;
|
||||||
if (!initial_ && tpp) w = tpp->getImageWidth (getProcParams(), h); // this might return 0 if image was just building
|
if (!initial_ && tpp) w = tpp->getImageWidth (getProcParams(), h, imgRatio); // this might return 0 if image was just building
|
||||||
if (w==0) w = tw * h / th;
|
if (w==0) {
|
||||||
|
if (imgRatio > 0.)
|
||||||
|
w = (int)(imgRatio * (float)h);
|
||||||
|
else
|
||||||
|
w = tw * h / th;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thumbnail::getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h) {
|
void Thumbnail::getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h) {
|
||||||
|
@@ -41,8 +41,9 @@ class Thumbnail {
|
|||||||
|
|
||||||
// if the thumbnail is in processed mode, this class holds its data:
|
// if the thumbnail is in processed mode, this class holds its data:
|
||||||
rtengine::Thumbnail* tpp;
|
rtengine::Thumbnail* tpp;
|
||||||
int tw, th; // dimensions of timgdata (it stores tpp->width and tpp->height in processed mode for simplicity)
|
int tw, th; // dimensions of timgdata (it stores tpp->width and tpp->height in processed mode for simplicity)
|
||||||
// double scale; // portion of the sizes of the processed thumbnail image and the full scale image
|
float imgRatio; // hack to avoid rounding error
|
||||||
|
// double scale; // portion of the sizes of the processed thumbnail image and the full scale image
|
||||||
|
|
||||||
rtengine::procparams::ProcParams pparams;
|
rtengine::procparams::ProcParams pparams;
|
||||||
bool pparamsValid;
|
bool pparamsValid;
|
||||||
|
Reference in New Issue
Block a user