diff options
| author | Bryce Harrington <bryce@bryceharrington.org> | 2007-02-21 09:32:19 +0000 |
|---|---|---|
| committer | bryce <bryce@users.sourceforge.net> | 2007-02-21 09:32:19 +0000 |
| commit | 1d29e3ba77e51174028c84be9b37fc675c32947d (patch) | |
| tree | 079f8e3fed3c85cf6c4f5c885de7aa2e8bf059d3 /src/ui/cache/svg_preview_cache.cpp | |
| parent | Adding handler for switching documents, to regenerate the marker menus (diff) | |
| download | inkscape-1d29e3ba77e51174028c84be9b37fc675c32947d.tar.gz inkscape-1d29e3ba77e51174028c84be9b37fc675c32947d.zip | |
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)
Diffstat (limited to 'src/ui/cache/svg_preview_cache.cpp')
| -rw-r--r-- | src/ui/cache/svg_preview_cache.cpp | 12 |
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; } }; |
