summaryrefslogtreecommitdiffstats
path: root/src/ui/cache/svg_preview_cache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/cache/svg_preview_cache.cpp')
-rw-r--r--src/ui/cache/svg_preview_cache.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ui/cache/svg_preview_cache.cpp b/src/ui/cache/svg_preview_cache.cpp
index 4aa46af2b..cee1db715 100644
--- a/src/ui/cache/svg_preview_cache.cpp
+++ b/src/ui/cache/svg_preview_cache.cpp
@@ -109,8 +109,11 @@ SvgPreview::~SvgPreview()
{
}
-Glib::ustring SvgPreview::cache_key(gchar const *name, unsigned psize) const {
- Glib::ustring key = name;
+Glib::ustring SvgPreview::cache_key(gchar const *uri, gchar const *name, unsigned psize) const {
+ Glib::ustring key;
+ key += (uri!=NULL) ? uri : "";
+ key += ":";
+ key += (name!=NULL) ? name : "unknown";
key += ":";
key += psize;
return key;
@@ -128,10 +131,10 @@ void SvgPreview::set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px) {
_pixmap_cache[key] = px;
}
-GdkPixbuf* SvgPreview::get_preview(const gchar* id, NRArenaItem *root,
+GdkPixbuf* SvgPreview::get_preview(const gchar* uri, const gchar* id, NRArenaItem *root,
double scale_factor, unsigned int psize) {
// First try looking up the cached preview in the cache map
- Glib::ustring key = cache_key(id, psize);
+ Glib::ustring key = cache_key(uri, id, psize);
GdkPixbuf* px = get_preview_from_cache(key);
if (px == NULL) {
@@ -140,6 +143,7 @@ GdkPixbuf* SvgPreview::get_preview(const gchar* id, NRArenaItem *root,
set_preview_in_cache(key, px);
*/
}
+ return px;
}
};