diff --git a/rtgui/batchqueue.cc b/rtgui/batchqueue.cc index 47b9daeaf..83155f0a2 100644 --- a/rtgui/batchqueue.cc +++ b/rtgui/batchqueue.cc @@ -62,6 +62,18 @@ BatchQueue::~BatchQueue () delete pmenu; } +// Reduce the max size of a thumb, since thumb is processed synchronously on adding to queue +// leading to very long waiting when adding more images +int BatchQueue::calcMaxThumbnailHeight() { + return MIN(options.maxThumbnailHeight, 200); +} + +// Function for virtual override in thumbbrowser base +int BatchQueue::getMaxThumbnailHeight() const { + return calcMaxThumbnailHeight(); +} + + void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry) { pmenu->popup (3, this->eventTime); @@ -163,11 +175,11 @@ void BatchQueue::loadBatchQueue( ) if( thumb ){ rtengine::ProcessingJob* job = rtengine::ProcessingJob::create(source, thumb->getType() == FT_Raw, pparams); - int prevh = options.maxThumbnailHeight; + int prevh = getMaxThumbnailHeight(); int prevw = prevh; guint8* prev = NULL; double tmpscale; - rtengine::IImage8* img = thumb->processThumbImage(pparams, options.maxThumbnailHeight, tmpscale); + rtengine::IImage8* img = thumb->processThumbImage(pparams, prevh, tmpscale); if (img) { prevw = img->getWidth(); prevh = img->getHeight(); diff --git a/rtgui/batchqueue.h b/rtgui/batchqueue.h index a26080719..2cf9b6870 100644 --- a/rtgui/batchqueue.h +++ b/rtgui/batchqueue.h @@ -40,6 +40,7 @@ class BatchQueue : public ThumbBrowserBase, public LWButtonListener { protected: + int getMaxThumbnailHeight() const; BatchQueueEntry* processing; // holds the currently processed image @@ -83,6 +84,7 @@ class BatchQueue : public ThumbBrowserBase, void loadBatchQueue (); static Glib::ustring calcAutoFileNameBase (const Glib::ustring& origFileName); + static int calcMaxThumbnailHeight(); }; #endif diff --git a/rtgui/filecatalog.cc b/rtgui/filecatalog.cc index 8658b7e01..5282c1005 100644 --- a/rtgui/filecatalog.cc +++ b/rtgui/filecatalog.cc @@ -832,25 +832,35 @@ void FileCatalog::developRequested (std::vector tbe) { if (listener) { std::vector entries; + + #pragma omp parallel for ordered for (size_t i=0; ithumbnail->getProcParams(); rtengine::ProcessingJob* pjob = rtengine::ProcessingJob::create (tbe[i]->filename, tbe[i]->thumbnail->getType()==FT_Raw, params); double tmpscale; - rtengine::IImage8* img = tbe[i]->thumbnail->processThumbImage (params, options.maxThumbnailHeight, tmpscale); + rtengine::IImage8* img = tbe[i]->thumbnail->processThumbImage (params, BatchQueue::calcMaxThumbnailHeight(), tmpscale); + + int pw, ph; + guint8* prev=NULL; + if (img) { - int pw = img->getWidth (); - int ph = img->getHeight (); - guint8* prev = new guint8 [pw*ph*3]; + pw = img->getWidth (); + ph = img->getHeight (); + prev = new guint8 [pw*ph*3]; memcpy (prev, img->getData (), pw*ph*3); img->free(); + + } else { + tbe[i]->thumbnail->getThumbnailSize (pw, ph); + } + + // processThumbImage is the processing intensive part, but adding to queue must be ordered + #pragma omp ordered + { entries.push_back(new BatchQueueEntry (pjob, params, tbe[i]->filename, prev, pw, ph, tbe[i]->thumbnail)); } - else { - int pw, ph; - tbe[i]->thumbnail->getThumbnailSize (pw, ph); - entries.push_back(new BatchQueueEntry (pjob, params, tbe[i]->filename, NULL, pw, ph, tbe[i]->thumbnail)); } - } + listener->addBatchQueueJobs( entries ); } } diff --git a/rtgui/thumbbrowserbase.cc b/rtgui/thumbbrowserbase.cc index 353043e2d..01c327811 100644 --- a/rtgui/thumbbrowserbase.cc +++ b/rtgui/thumbbrowserbase.cc @@ -478,13 +478,13 @@ void ThumbBrowserBase::zoomChanged (bool zoomIn) { int optThumbSize=getCurrentThumbSize(); if (zoomIn) for (i=0; i optThumbSize) break; } else for (i=options.thumbnailZoomRatios.size()-1; i>=0; i--) { - newHeight = (int)(options.thumbnailZoomRatios[i] * options.maxThumbnailHeight); + newHeight = (int)(options.thumbnailZoomRatios[i] * getMaxThumbnailHeight()); if (newHeight < optThumbSize) break; } diff --git a/rtgui/thumbbrowserbase.h b/rtgui/thumbbrowserbase.h index 3095ee5d4..92fa20237 100644 --- a/rtgui/thumbbrowserbase.h +++ b/rtgui/thumbbrowserbase.h @@ -22,6 +22,7 @@ #include #include #include +#include /* * Class handling the list of ThumbBrowserEntry objects and their position in it's allocated space @@ -52,6 +53,7 @@ class ThumbBrowserBase : public Gtk::VBox { }; protected: + virtual int getMaxThumbnailHeight() const { return options.maxThumbnailHeight; } // Differs between batch and file Internal internal; Gtk::HScrollbar hscroll;