summaryrefslogtreecommitdiffstats
path: root/src/display/drawing-surface.h
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-07-28 05:04:08 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-07-28 05:04:08 +0000
commit905b8a96963f78358abfd109c0c49758c6fe4e9d (patch)
treef36eff88e8cc148264f9ea46df7b525c6a9ea80e /src/display/drawing-surface.h
parentAdd deferred allocation functionality to DrawingSurface (diff)
downloadinkscape-905b8a96963f78358abfd109c0c49758c6fe4e9d.tar.gz
inkscape-905b8a96963f78358abfd109c0c49758c6fe4e9d.zip
Per-item render cache.
Cache some offscreen data to facilitate smoother navigation. (bzr r10347.1.20)
Diffstat (limited to 'src/display/drawing-surface.h')
-rw-r--r--src/display/drawing-surface.h22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/display/drawing-surface.h b/src/display/drawing-surface.h
index e26bc28fa..f279d771b 100644
--- a/src/display/drawing-surface.h
+++ b/src/display/drawing-surface.h
@@ -26,7 +26,6 @@ class DrawingSurface
{
public:
explicit DrawingSurface(Geom::IntRect const &area);
- explicit DrawingSurface(Geom::Rect const &area);
DrawingSurface(Geom::Rect const &logbox, Geom::IntPoint const &pixdims);
DrawingSurface(cairo_surface_t *surface, Geom::Point const &origin);
virtual ~DrawingSurface();
@@ -44,6 +43,8 @@ public:
cairo_t *createRawContext();
protected:
+ Geom::IntRect pixelArea() const;
+
cairo_surface_t *_surface;
Geom::Point _origin;
Geom::Scale _scale;
@@ -53,16 +54,23 @@ protected:
friend class DrawingContext;
};
-class PixbufSurface
+class DrawingCache
: public DrawingSurface
{
public:
- explicit PixbufSurface(GdkPixbuf *pb, Geom::Point const &origin = Geom::Point(0,0));
- ~PixbufSurface();
-protected:
- GdkPixbuf *pb;
+ explicit DrawingCache(Geom::IntRect const &area);
+ ~DrawingCache();
- friend class DrawingContext;
+ void markDirty(Geom::IntRect const &area = Geom::IntRect::infinite());
+ void markClean(Geom::IntRect const &area = Geom::IntRect::infinite());
+ bool isClean(Geom::IntRect const &area) const;
+ void resizeAndTransform(Geom::IntRect const &new_area, Geom::Affine const &trans);
+ bool paintFromCache(DrawingContext &ct, Geom::IntRect const &area);
+
+protected:
+ cairo_region_t *_clean_region;
+private:
+ static cairo_rectangle_int_t _convertRect(Geom::IntRect const &r);
};
} // end namespace Inkscape