From 842e4460605606df293cca5e1800f71dd3677cc9 Mon Sep 17 00:00:00 2001 From: natureh Date: Sat, 2 Jun 2012 14:46:50 +0200 Subject: [PATCH] Patch from issue 1384: "Speedup enhancement of the thumbnails' browser" --- rtgui/profilestore.cc | 24 ++++++++++++++++++------ rtgui/profilestore.h | 9 +++++---- rtgui/thumbnail.cc | 4 ++-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/rtgui/profilestore.cc b/rtgui/profilestore.cc index a971d6455..bbeba0460 100644 --- a/rtgui/profilestore.cc +++ b/rtgui/profilestore.cc @@ -185,12 +185,24 @@ ProcParams* ProfileStore::getDefaultProcParams (bool isRaw) { //Note: the mutex is locked in getProfile, called below PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg); - // NOTE: pProf should not be NULL anymore, since init() should have created the default profiles already, but the code is left as is - if (!pProf) { - pProf = new PartialProfile (true); - pProf->set(true); - partProfiles[DEFPROFILE_INTERNAL] = pProf; - } + // NOTE: pProf should not be NULL anymore, since init() should have created the default profiles already return pProf->pparams; } +/* + * Send back a pointer to the default partial profile for raw or standard images. + * If it doesn't already exist in the profile list, it will add it with default internal values, + * so this method will never fails + */ +PartialProfile* ProfileStore::getDefaultPartialProfile (bool isRaw) { + + if (!init()) + // I don't even know if this situation can occur + return NULL; + //Note: the mutex is locked in getProfile, called below + + PartialProfile* pProf = getProfile (isRaw ? options.defProfRaw : options.defProfImg); + // NOTE: pProf should not be NULL anymore, since init() should have created the default profiles already + return pProf; +} + diff --git a/rtgui/profilestore.h b/rtgui/profilestore.h index 312df1913..40d3def30 100644 --- a/rtgui/profilestore.h +++ b/rtgui/profilestore.h @@ -28,10 +28,10 @@ class ProfileStore { typedef enum { - STORESTATE_NOTINITIALIZED, - STORESTATE_BEINGINITIALIZED, - STORESTATE_INITIALIZED, - STORESTATE_DELETED + STORESTATE_NOTINITIALIZED, + STORESTATE_BEINGINITIALIZED, + STORESTATE_INITIALIZED, + STORESTATE_DELETED } StoreState; Glib::Mutex *parseMutex; @@ -49,6 +49,7 @@ class ProfileStore { rtengine::procparams::PartialProfile* getProfile (const Glib::ustring& profname); std::vector getProfileNames (); rtengine::procparams::ProcParams* getDefaultProcParams (bool isRaw); + rtengine::procparams::PartialProfile* getDefaultPartialProfile (bool isRaw); }; extern ProfileStore profileStore; diff --git a/rtgui/thumbnail.cc b/rtgui/thumbnail.cc index a2aadaa91..914b30e54 100644 --- a/rtgui/thumbnail.cc +++ b/rtgui/thumbnail.cc @@ -232,8 +232,8 @@ void Thumbnail::loadProcParams () { pparamsValid = false; pparams.setDefaults(); - // WARNING: loading the default Raw or Img pp3 file at each thumbnail may be a performance bottleneck - pparams.load(options.profilePath+"/" + (getType()==FT_Raw?options.defProfRaw:options.defProfImg) + paramFileExtension); + PartialProfile *defaultPP = profileStore.getDefaultPartialProfile(getType()==FT_Raw); + defaultPP->applyTo(&pparams); if (options.paramsLoadLocation==PLL_Input) { // try to load it from params file next to the image file