Adding icons on thumbnails and solving a bug in cacheimagedata.cc
See issue #4008. The bug in cacheimagedata.cc was preventing correct cached thumbnail loading, asking for a full processing at each loading of the directory.
This commit is contained in:
@@ -139,7 +139,7 @@ int CacheImageData::load (const Glib::ustring& fname)
|
||||
}
|
||||
|
||||
if (keyFile.has_key ("ExifInfo", "IsHDR")) {
|
||||
isHDR = keyFile.get_integer ("ExifInfo", "IsHDR");
|
||||
isHDR = keyFile.get_boolean ("ExifInfo", "IsHDR");
|
||||
}
|
||||
|
||||
if (keyFile.has_key ("ExifInfo", "IsPixelShift")) {
|
||||
|
@@ -36,6 +36,8 @@ bool FileBrowserEntry::iconsLoaded(false);
|
||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::editedIcon;
|
||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::recentlySavedIcon;
|
||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::enqueuedIcon;
|
||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::hdr;
|
||||
Glib::RefPtr<Gdk::Pixbuf> FileBrowserEntry::ps;
|
||||
|
||||
FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname)
|
||||
: ThumbBrowserEntryBase (fname), wasInside(false), iatlistener(nullptr), press_x(0), press_y(0), action_x(0), action_y(0), rot_deg(0.0), landscape(true), cropgl(nullptr), state(SNormal), crop_custom_ratio(0.f)
|
||||
@@ -57,6 +59,8 @@ FileBrowserEntry::FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname)
|
||||
editedIcon = RTImage::createFromFile ("edited.png");
|
||||
recentlySavedIcon = RTImage::createFromFile ("recent-save.png");
|
||||
enqueuedIcon = RTImage::createFromFile ("processing.png");
|
||||
hdr = RTImage::createFromFile ("HDR-thumbnail.png");
|
||||
ps = RTImage::createFromFile ("PixelShift-thumbnail.png");
|
||||
iconsLoaded = true;
|
||||
}
|
||||
|
||||
@@ -137,6 +141,26 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > FileBrowserEntry::getIconsOnImageArea ()
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf> > FileBrowserEntry::getSpecificityIconsOnImageArea ()
|
||||
{
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ret;
|
||||
|
||||
if (!thumbnail) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (thumbnail->isHDR() && hdr) {
|
||||
ret.push_back (hdr);
|
||||
}
|
||||
|
||||
if (thumbnail->isPixelShift() && ps) {
|
||||
ret.push_back (ps);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void FileBrowserEntry::customBackBufferUpdate (Cairo::RefPtr<Cairo::Context> c)
|
||||
{
|
||||
if(scale != 1.0 && cropParams.enabled) { // somewhere in pipeline customBackBufferUpdate is called when scale == 1.0, which is nonsense for a thumb
|
||||
|
@@ -70,6 +70,8 @@ public:
|
||||
static Glib::RefPtr<Gdk::Pixbuf> editedIcon;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> recentlySavedIcon;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> enqueuedIcon;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> hdr;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> ps;
|
||||
|
||||
FileBrowserEntry (Thumbnail* thm, const Glib::ustring& fname);
|
||||
~FileBrowserEntry ();
|
||||
@@ -87,6 +89,7 @@ public:
|
||||
void calcThumbnailSize ();
|
||||
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf> > getIconsOnImageArea ();
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf> > getSpecificityIconsOnImageArea ();
|
||||
virtual void getIconSize (int& w, int& h);
|
||||
|
||||
// thumbnaillistener interface
|
||||
|
@@ -160,6 +160,7 @@ void ThumbBrowserEntryBase::updateBackBuffer ()
|
||||
|
||||
// draw icons onto the thumbnail area
|
||||
bbIcons = getIconsOnImageArea ();
|
||||
bbSpecificityIcons = getSpecificityIconsOnImageArea ();
|
||||
|
||||
int infow, infoh;
|
||||
getTextSizes (infow, infoh);
|
||||
@@ -224,6 +225,19 @@ void ThumbBrowserEntryBase::updateBackBuffer ()
|
||||
}
|
||||
}
|
||||
|
||||
if (!bbSpecificityIcons.empty()) {
|
||||
int igap = 2;
|
||||
int istartx2 = prex + prew - 1 + igap;
|
||||
int istarty2 = prey + preh - igap - 1;
|
||||
|
||||
for (size_t i = 0; i < bbSpecificityIcons.size(); ++i) {
|
||||
istartx2 -= bbSpecificityIcons[i]->get_width() - igap;
|
||||
Gdk::Cairo::set_source_pixbuf(cc, bbSpecificityIcons[i], istartx2, istarty2 - bbSpecificityIcons[i]->get_height());
|
||||
cc->rectangle(istartx2, istarty2 - bbSpecificityIcons[i]->get_height(), bbSpecificityIcons[i]->get_width(), bbSpecificityIcons[i]->get_height());
|
||||
cc->fill();
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( (parent->getLocation() != ThumbBrowserBase::THLOC_EDITOR && options.showFileNames)
|
||||
|| (parent->getLocation() == ThumbBrowserBase::THLOC_EDITOR && options.filmStripShowFileNames))
|
||||
&& withFilename > WFNAME_NONE) {
|
||||
@@ -512,7 +526,9 @@ void ThumbBrowserEntryBase::draw (Cairo::RefPtr<Cairo::Context> cc)
|
||||
}
|
||||
|
||||
if (!backBuffer || selected != bbSelected || framed != bbFramed || preview != bbPreview
|
||||
|| exp_width != bbWidth || exp_height != bbHeight || getIconsOnImageArea () != bbIcons || backBuffer->isDirty()) {
|
||||
|| exp_width != bbWidth || exp_height != bbHeight || getIconsOnImageArea () != bbIcons
|
||||
|| getSpecificityIconsOnImageArea() != bbSpecificityIcons || backBuffer->isDirty())
|
||||
{
|
||||
updateBackBuffer ();
|
||||
}
|
||||
|
||||
@@ -592,6 +608,11 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getIconsOnImageAr
|
||||
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
|
||||
}
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getSpecificityIconsOnImageArea()
|
||||
{
|
||||
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
|
||||
}
|
||||
|
||||
void ThumbBrowserEntryBase::getIconSize(int& w, int& h)
|
||||
{
|
||||
w = 0;
|
||||
|
@@ -80,6 +80,7 @@ protected:
|
||||
bool bbSelected, bbFramed;
|
||||
guint8* bbPreview;
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf> > bbIcons;
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf> > bbSpecificityIcons;
|
||||
CursorShape cursor_type;
|
||||
|
||||
void drawFrame (Cairo::RefPtr<Cairo::Context> cr, const Gdk::RGBA& bg, const Gdk::RGBA& fg);
|
||||
@@ -185,6 +186,7 @@ public:
|
||||
virtual void drawProgressBar (Glib::RefPtr<Gdk::Window> win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h) {}
|
||||
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf> > getIconsOnImageArea ();
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf> > getSpecificityIconsOnImageArea ();
|
||||
virtual void getIconSize (int& w, int& h);
|
||||
|
||||
virtual bool motionNotify (int x, int y);
|
||||
|
@@ -499,6 +499,15 @@ bool Thumbnail::isEnqueued ()
|
||||
return enqueueNumber > 0;
|
||||
}
|
||||
|
||||
bool Thumbnail::isPixelShift ()
|
||||
{
|
||||
return cfs.isPixelShift;
|
||||
}
|
||||
bool Thumbnail::isHDR ()
|
||||
{
|
||||
return cfs.isHDR;
|
||||
}
|
||||
|
||||
void Thumbnail::increaseRef ()
|
||||
{
|
||||
MyMutex::MyLock lock(mutex);
|
||||
|
@@ -107,6 +107,8 @@ public:
|
||||
void imageEnqueued ();
|
||||
void imageRemovedFromQueue ();
|
||||
bool isEnqueued ();
|
||||
bool isPixelShift ();
|
||||
bool isHDR ();
|
||||
|
||||
// unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w
|
||||
rtengine::IImage8* processThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
|
||||
|
Reference in New Issue
Block a user