Code

the SP_IS_GAUSSIANBLUR fix is not only for shapes. fixme: this boilerplate definitely...
[inkscape.git] / src / display / nr-arena-item.h
index 7a6c676024e96cf18c03ab30e7c20addf36c75be..103315c5eadd2ca4f316cc6c1e53b4938259dfa2 100644 (file)
 #include "gc-soft-ptr.h"
 #include "nr-arena-forward.h"
 #include "display/nr-filter.h"
-/* TODO: without this, gcc barfs on clause "NR::Filter *filter" later on.
- * Obviously we shouldn't need to have the next three rows */
-namespace NR {
-class Filter;
-}
-
-// My testing shows that disabling cache reduces the amount 
-// of leaked memory when many documents are loaded one from the other,
-// while there's no noticeable change in speed
-//#define arena_item_tile_cache
+#include <cairo.h>
 
 struct NRGC {
        NRGC(NRGC const *p) : parent(p) {}
@@ -96,11 +87,6 @@ struct NRArenaItem : public NRObject {
        /* Key for secondary rendering */
        unsigned int key;
   
-#ifdef arena_item_tile_cache
-  bool     skipCaching;
-  double   activity;
-#endif
-  
        /* BBox in grid coordinates */
        NRRectL bbox;
        /* Our affine */
@@ -120,6 +106,10 @@ struct NRArenaItem : public NRObject {
         /* Current Transformation Matrix */
         NR::Matrix ctm;
 
+        /* These hold background buffer state for filter rendering */
+        NRPixBlock *background_pb;
+        bool background_new;
+
        void init(NRArena *arena) {
                this->arena = arena;
        }
@@ -133,7 +123,7 @@ struct NRArenaItemClass : public NRObjectClass {
        void (* set_child_position) (NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref);
 
        unsigned int (* update) (NRArenaItem *item, NRRectL *area, NRGC *gc, unsigned int state, unsigned int reset);
-       unsigned int (* render) (NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
+       unsigned int (* render) (cairo_t *ct, NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
        unsigned int (* clip) (NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
        NRArenaItem * (* pick) (NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
 };
@@ -162,7 +152,7 @@ void nr_arena_item_set_child_position (NRArenaItem *item, NRArenaItem *child, NR
 
 unsigned int nr_arena_item_invoke_update (NRArenaItem *item, NRRectL *area, NRGC *gc, unsigned int state, unsigned int reset);
 
-unsigned int nr_arena_item_invoke_render(NRArenaItem *item, NRRectL const *area, NRPixBlock *pb, unsigned int flags);
+unsigned int nr_arena_item_invoke_render(cairo_t *ct, NRArenaItem *item, NRRectL const *area, NRPixBlock *pb, unsigned int flags);
 
 unsigned int nr_arena_item_invoke_clip (NRArenaItem *item, NRRectL *area, NRPixBlock *pb);
 NRArenaItem *nr_arena_item_invoke_pick (NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
@@ -185,6 +175,8 @@ void nr_arena_item_set_clip (NRArenaItem *item, NRArenaItem *clip);
 void nr_arena_item_set_mask (NRArenaItem *item, NRArenaItem *mask);
 void nr_arena_item_set_order (NRArenaItem *item, int order);
 
+NRPixBlock *nr_arena_item_get_background (NRArenaItem const *item, int depth = 0);
+
 /* Helpers */
 
 NRArenaItem *nr_arena_item_attach (NRArenaItem *parent, NRArenaItem *child, NRArenaItem *prev, NRArenaItem *next);