Code

Super duper mega (fun!) commit: replaced encoding=utf-8 with fileencoding=utf-8 in...
[inkscape.git] / src / ui / cache / svg_preview_cache.h
index 2d84b7273ae6f436e3fb13cc2fc55f3e7a9fb1ed..0fac94782ba93cf8789f127cb8f523a47a7a07a8 100644 (file)
@@ -11,7 +11,7 @@
  *
  */
 
-GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const NR::Rect& dbox, unsigned psize);
+GdkPixbuf* render_pixbuf(NRArenaItem* root, double scale_factor, const Geom::Rect& dbox, unsigned psize);
 
 namespace Inkscape {
 namespace UI {
@@ -22,41 +22,13 @@ class SvgPreview {
     std::map<Glib::ustring, GdkPixbuf*>   _pixmap_cache;
 
  public:
-    SvgPreview() {}
-    ~SvgPreview() {}
+    SvgPreview();
+    ~SvgPreview();
 
-    Glib::ustring cache_key(gchar const *name, unsigned psize) const {
-        Glib::ustring key = name;
-        key += ":";
-        key += psize;
-        return key;
-    }
-
-    GdkPixbuf* get_preview_from_cache(const Glib::ustring& key) {
-        std::map<Glib::ustring, GdkPixbuf *>::iterator found = _pixmap_cache.find(key);
-        if ( found != _pixmap_cache.end() ) {
-            return found->second;
-        }
-        return NULL;
-    }
-
-    void set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px) {
-        _pixmap_cache[key] = px;
-    }
-
-    GdkPixbuf* get_preview(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);
-        GdkPixbuf* px = get_preview_from_cache(key);
-
-        if (px == NULL) {
-/*
-            px = render_pixbuf(root, scale_factor, dbox, psize);
-            set_preview_in_cache(key, px);
-*/
-        }
-
-    }
+    Glib::ustring cache_key(gchar const *uri, gchar const *name, unsigned psize) const;
+    GdkPixbuf*    get_preview_from_cache(const Glib::ustring& key);
+    void          set_preview_in_cache(const Glib::ustring& key, GdkPixbuf* px);
+    GdkPixbuf*    get_preview(const gchar* uri, const gchar* id, NRArenaItem *root, double scale_factor, unsigned int psize);
 };
 
 }; // namespace Cache
@@ -75,6 +47,6 @@ class SvgPreview {
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :