diff --git a/rtgui/cacheimagedata.cc b/rtgui/cacheimagedata.cc index 9018257dd..01871780d 100644 --- a/rtgui/cacheimagedata.cc +++ b/rtgui/cacheimagedata.cc @@ -23,7 +23,7 @@ CacheImageData::CacheImageData () : md5(""), supported(false), format(FT_Invalid), rank(0), inTrash(false), recentlySaved(false), - timeValid(false), exifValid(false) { + timeValid(false), exifValid(false), thumbImgType(0) { } int CacheImageData::load (const Glib::ustring& fname) { diff --git a/rtgui/cacheimagedata.h b/rtgui/cacheimagedata.h index 828a7ca44..e843c39a5 100644 --- a/rtgui/cacheimagedata.h +++ b/rtgui/cacheimagedata.h @@ -59,6 +59,12 @@ class CacheImageData { int thumbImgType; int thumbOffset; + enum + { + FULL_THUMBNAIL = 0, // was the thumbnail generated from whole file + QUICK_THUMBNAIL = 1, // was rhe thumbnail generated from embedded jpeg + }; + CacheImageData (); int load (const Glib::ustring& fname); diff --git a/rtgui/filebrowserentry.cc b/rtgui/filebrowserentry.cc index b31d6b454..e8e818020 100644 --- a/rtgui/filebrowserentry.cc +++ b/rtgui/filebrowserentry.cc @@ -136,7 +136,14 @@ FileThumbnailButtonSet* FileBrowserEntry::getThumbButtonSet () { void FileBrowserEntry::procParamsChanged (Thumbnail* thm, int whoChangedIt) { - refreshThumbnailImage (); + if ( thumbnail->isQuick() ) + { + refreshQuickThumbnailImage (); + } + else + { + refreshThumbnailImage (); + } } struct tiupdate { diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index 3f57b69ac..cb73bd1bf 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -35,7 +35,7 @@ using namespace rtengine::procparams; Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageData* cf) : fname(fname), cfs(*cf), cachemgr(cm), ref(1), enqueueNumber(0), tpp(NULL), pparamsValid(false), needsReProcessing(true), lastImg(NULL), - quick_(false), initial_(false) { + initial_(false) { cfs.load (getCacheFileName ("data")+".txt"); loadProcParams (); @@ -46,7 +46,7 @@ Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, CacheImageDa Thumbnail::Thumbnail (CacheManager* cm, const Glib::ustring& fname, const std::string& md5) : fname(fname), cachemgr(cm), ref(1), enqueueNumber(0), tpp(NULL), pparamsValid(false), needsReProcessing(true), lastImg(NULL), - quick_(false), initial_(true) { + initial_(true) { cfs.md5 = md5; @@ -97,36 +97,32 @@ void Thumbnail::_generateThumbnailImage () { // 1. if we are here it's because we aren't in the cache so load the JPG // image out of the RAW. Mark as "quick". // 2. if we don't find that then just grab the real image. + bool quick = false; rtengine::RawMetaDataLocation ri; if ( initial_ ) { - quick_ = true; + quick = true; tpp = rtengine::Thumbnail::loadQuickFromRaw (fname, ri, tw, th, 1); } if ( tpp == 0 ) { - quick_ = false; + quick = false; tpp = rtengine::Thumbnail::loadFromRaw (fname, ri, tw, th, 1); } if (tpp) { cfs.format = FT_Raw; + cfs.thumbImgType = quick ? CacheImageData::QUICK_THUMBNAIL : CacheImageData::FULL_THUMBNAIL; infoFromImage (fname, &ri); } } if (tpp ) { - if ( !quick_ ) - { - _saveThumbnail (); - } + _saveThumbnail (); cfs.supported = true; } needsReProcessing = true; - if ( !quick_ ) - { - cfs.save (getCacheFileName ("data")+".txt"); - } + cfs.save (getCacheFileName ("data")+".txt"); generateExifDateTimeStrings (); } @@ -282,7 +278,7 @@ rtengine::IImage8* Thumbnail::processThumbImage (const rtengine::procparams::Pro if (!tpp) return NULL; - if ( quick_ ) + if ( cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL ) { return tpp->quickProcessImage (pparams, h, rtengine::TI_Nearest, scale); } @@ -296,12 +292,11 @@ rtengine::IImage8* Thumbnail::upgradeThumbImage (const rtengine::procparams::Pro Glib::Mutex::Lock lock(mutex); - if ( !quick_ ) + if ( cfs.thumbImgType != CacheImageData::QUICK_THUMBNAIL ) { return 0; } - quick_ = false; _generateThumbnailImage(); return tpp->processImage (pparams, h, rtengine::TI_Bilinear, scale); } @@ -413,7 +408,7 @@ void Thumbnail::_loadThumbnail(bool firstTrial) { delete tpp; tpp = NULL; } - else { + else if ( cfs.thumbImgType == CacheImageData::FULL_THUMBNAIL ) { // load aehistogram tpp->readAEHistogram (getCacheFileName ("aehistograms")); diff --git a/rtgui/thumbnail.h b/rtgui/thumbnail.h index ac75236d4..6c7e8aec2 100644 --- a/rtgui/thumbnail.h +++ b/rtgui/thumbnail.h @@ -59,7 +59,6 @@ class Thumbnail { Glib::ustring dateTimeString; bool initial_; - bool quick_; // vector of listeners std::vector listeners; @@ -84,7 +83,7 @@ class Thumbnail { void clearProcParams (int whoClearedIt=-1); void loadProcParams (); - bool isQuick() { return quick_; } + bool isQuick() { return cfs.thumbImgType == CacheImageData::QUICK_THUMBNAIL; } bool isPParamsValid() { return pparamsValid; } bool isRecentlySaved (); void imageDeveloped ();