Code

API change: render methods now take a cairo_t (not yet used)
[inkscape.git] / src / display / nr-arena-item.cpp
index e7eab8b8556d2ea8b165ef304da0acd41172b6b9..f449acf4a741e2ac44cc9e07d22b6cc92c01a09e 100644 (file)
@@ -292,7 +292,7 @@ nr_arena_item_invoke_update (NRArenaItem *item, NRRectL *area, NRGC *gc,
  */
 
 unsigned int
-nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
+nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area,
                              NRPixBlock *pb, unsigned int flags)
 {
    bool outline = (item->arena->rendermode == RENDERMODE_OUTLINE);
@@ -377,7 +377,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
                                 TRUE);
 
         //  if memory allocation failed, abort render
-        if (ipb.data.px == NULL) {
+        if (ipb.size != NR_PIXBLOCK_SIZE_TINY && ipb.data.px == NULL) {
             nr_pixblock_release (&ipb);
             return (item->state);
         }
@@ -389,7 +389,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
             item->background_pb = &ipb;
         }
         ipb.visible_area = pb->visible_area;
-        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (item, &carea, &ipb, flags);
+        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (ct, item, &carea, &ipb, flags);
         if (state & NR_ARENA_ITEM_STATE_INVALID) {
             /* Clean up and return error */
             nr_pixblock_release (&ipb);
@@ -439,7 +439,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
                     if (tpb.data.px != NULL) { // if memory allocation was successful
 
                         tpb.visible_area = pb->visible_area;
-                        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item->mask, render) (item->mask, &carea, &tpb, flags);
+                        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item->mask, render) (ct, item->mask, &carea, &tpb, flags);
                         if (state & NR_ARENA_ITEM_STATE_INVALID) {
                             /* Clean up and return error */
                             nr_pixblock_release (&tpb);
@@ -516,7 +516,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
             // Render clipped or masked object in outline mode:
 
             // First, render the object itself 
-            unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (item, &carea, dpb, flags);
+            unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (ct, item, &carea, dpb, flags);
             if (state & NR_ARENA_ITEM_STATE_INVALID) {
                 /* Clean up and return error */
                 if (dpb != pb)
@@ -529,12 +529,12 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
             // render clippath as an object, using a different color
             if (item->clip) {
                 item->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "clips", 0x00ff00ff); // green clips
-                NR_ARENA_ITEM_VIRTUAL (item->clip, render) (item->clip, &carea, dpb, flags);
+                NR_ARENA_ITEM_VIRTUAL (item->clip, render) (ct, item->clip, &carea, dpb, flags);
             } 
             // render mask as an object, using a different color
             if (item->mask) {
                 item->arena->outlinecolor = prefs_get_int_attribute("options.wireframecolors", "masks", 0x0000ffff); // blue masks
-                NR_ARENA_ITEM_VIRTUAL (item->mask, render) (item->mask, &carea, dpb, flags);
+                NR_ARENA_ITEM_VIRTUAL (item->mask, render) (ct, item->mask, &carea, dpb, flags);
             }
             item->arena->outlinecolor = saved_rgba; // restore outline color
 
@@ -549,7 +549,7 @@ nr_arena_item_invoke_render (NRArenaItem *item, NRRectL const *area,
         dpb->empty = FALSE;
     } else {
         /* Just render */
-        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (item, &carea, dpb, flags);
+        unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (ct, item, &carea, dpb, flags);
         if (state & NR_ARENA_ITEM_STATE_INVALID) {
             /* Clean up and return error */
             if (dpb != pb)
@@ -836,7 +836,7 @@ nr_arena_item_get_background (NRArenaItem const *item, int depth)
                                 item->background_pb->area.y0,
                                 item->background_pb->area.x1,
                                 item->background_pb->area.y1, true);
-        if (pb->data.px == NULL) // allocation failed
+        if (pb->size != NR_PIXBLOCK_SIZE_TINY && pb->data.px == NULL) // allocation failed
             return NULL;
     } else if (item->parent) {
         pb = nr_arena_item_get_background (item->parent, depth + 1);