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:
natureh
2011-08-23 23:22:17 +02:00
parent c7ce3611e2
commit 2f3549653a
5 changed files with 25 additions and 13 deletions

View File

@@ -91,7 +91,7 @@ void ThumbBrowserEntryBase::updateBackBuffer () {
}
// 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
if (preview) {
prex = borderWidth + (exp_width-prew)/2;
@@ -296,7 +296,9 @@ void ThumbBrowserEntryBase::resize (int h) {
delete [] preview;
preview = NULL;
refreshThumbnailImage ();
} // causes skewed thumb sometimes: else updateBackBuffer();
}
else
updateBackBuffer();
drawable = true;
}

View File

@@ -85,6 +85,7 @@ void Thumbnail::_generateThumbnailImage () {
lastImg = NULL;
tw = -1;
th = options.maxThumbnailHeight;
imgRatio = -1.;
// generate thumbnail image
Glib::ustring ext = getExtension (fname);
@@ -388,8 +389,13 @@ void Thumbnail::getThumbnailSize (int &w, int &h) {
#endif
w=0;
if (!initial_ && tpp) w = tpp->getImageWidth (getProcParams(), h); // this might return 0 if image was just building
if (w==0) w = tw * h / th;
if (!initial_ && tpp) w = tpp->getImageWidth (getProcParams(), h, imgRatio); // this might return 0 if image was just building
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) {

View File

@@ -41,9 +41,10 @@ class Thumbnail {
// if the thumbnail is in processed mode, this class holds its data:
rtengine::Thumbnail* tpp;
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
int tw, th; // dimensions of timgdata (it stores tpp->width and tpp->height in processed mode for simplicity)
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;
bool pparamsValid;
bool pparamsSet;