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:
Hombre57
2017-08-13 18:13:39 +02:00
parent d5e4980c08
commit 86dac147c6
19 changed files with 104 additions and 44 deletions

View File

@@ -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;