From 841fc32e3cb636f99cbdcd9a20db9c2ee6d8fdca Mon Sep 17 00:00:00 2001 From: Oliver Duis Date: Fri, 29 Apr 2011 18:57:45 +0200 Subject: [PATCH] Fix file rotation problem in thumb browser, see issue #621 --- rtgui/filebrowserentry.cc | 20 ++++++++++++++++++-- rtgui/filebrowserentry.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index 1f17c24ec..8ff6a2801 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -212,8 +212,16 @@ void FileBrowserEntry::_updateImage (rtengine::IImage8* img, double s, rtengine: redrawRequests--; scale = s; this->cropParams = cropParams; + + bool newLandscape = img->getWidth() > img->getHeight(); + bool rotated=false; + if (preh == img->getHeight ()) { prew = img->getWidth (); + + // Check if image has been rotated since last time + rotated = preview!=NULL && newLandscape!=landscape; + guint8* temp = preview; preview = NULL; delete [] temp; @@ -222,9 +230,17 @@ void FileBrowserEntry::_updateImage (rtengine::IImage8* img, double s, rtengine: preview = temp; updateBackBuffer (); } - if (redrawRequests==0 && parent) - parent->redrawNeeded (this); + + landscape = newLandscape; + img->free (); + + if (parent!=NULL) { + if (rotated) + parent->thumbRearrangementNeeded(); + else if (redrawRequests==0) + parent->redrawNeeded (this); + } } bool FileBrowserEntry::motionNotify (int x, int y) { diff --git a/rtgui/filebrowserentry.h b/rtgui/filebrowserentry.h index 490e0d100..349e98bf2 100644 --- a/rtgui/filebrowserentry.h +++ b/rtgui/filebrowserentry.h @@ -48,6 +48,7 @@ class FileBrowserEntry : public ThumbBrowserEntryBase, ImageAreaToolListener* iatlistener; int press_x, press_y, action_x, action_y; double rot_deg; + bool landscape; rtengine::procparams::CropParams cropParams; CropGUIListener* cropgl; FileBrowserEntryIdleHelper* feih;