From 1d29e3ba77e51174028c84be9b37fc675c32947d Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Wed, 21 Feb 2007 09:32:19 +0000 Subject: Fixes issue where a modified stock marker's preview image appears in the marker dropdown with the same preview image as the unmodified stock marker. This adds the source document's uri to the cache index. (bzr r2413) --- src/ui/cache/svg_preview_cache.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ui/cache/svg_preview_cache.cpp') 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; } }; -- cgit v1.2.3