From 695303a5474c1026b5611e86909ff840efb9ee3c Mon Sep 17 00:00:00 2001 From: kiirala Date: Thu, 7 Jun 2007 17:52:46 +0000 Subject: [PATCH] Fixed background access problems introduced in previous revision --- src/display/nr-arena-item.cpp | 10 ++++------ src/display/nr-filter-slot.cpp | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index a4fdcf5bc..d98bbaf3a 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -414,10 +414,9 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area /* If background access is used, save the pixblock address. * This address is set to NULL at the end of this block */ - if (item->background_new) { + if (item->background_new || + (item->parent && item->parent->background_pb)) { item->background_pb = &ipb; - } else if (item->parent && item->parent->background_pb) { - item->background_pb = item->parent->background_pb; } ipb.visible_area = pb->visible_area; unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (ct, item, &carea, &ipb, flags); @@ -540,9 +539,6 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area nr_blit_pixblock_pixblock_mask (dpb, &ipb, &mpb); } nr_pixblock_release (&mpb); - /* This pointer wouldn't be valid outside this block, so clear it */ - item->background_pb = NULL; - } else { if (item->render_opacity) { // opacity was already rendered in, just copy to dpb here nr_blit_pixblock_pixblock(dpb, &ipb); @@ -552,6 +548,8 @@ nr_arena_item_invoke_render (cairo_t *ct, NRArenaItem *item, NRRectL const *area } nr_pixblock_release (&ipb); dpb->empty = FALSE; + /* This pointer wouldn't be valid outside this block, so clear it */ + item->background_pb = NULL; } else { /* Just render */ unsigned int state = NR_ARENA_ITEM_VIRTUAL (item, render) (ct, item, &carea, dpb, flags); diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 250aee10b..32fc00f99 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -16,9 +16,10 @@ #include #include "display/nr-arena-item.h" -#include "libnr/nr-pixblock.h" #include "display/nr-filter-types.h" #include "display/nr-filter-slot.h" +#include "libnr/nr-pixblock.h" +#include "libnr/nr-blit.h" namespace NR { @@ -71,7 +72,16 @@ NRPixBlock *FilterSlot::get(int slot_nr) NRPixBlock *pb; pb = nr_arena_item_get_background(_arena_item); if (pb) { - this->set(NR_FILTER_BACKGROUNDIMAGE, pb); + NRPixBlock *bg = new NRPixBlock; + nr_pixblock_setup_fast(bg, pb->mode, + pb->area.x0, pb->area.y0, + pb->area.x1, pb->area.y1, true); + bool empty = pb->empty; + pb->empty = false; + nr_blit_pixblock_pixblock(bg, pb); + pb->empty = empty; + bg->empty = false; + this->set(NR_FILTER_BACKGROUNDIMAGE, bg); } else { NRPixBlock *source = this->get(NR_FILTER_SOURCEGRAPHIC); pb = new NRPixBlock(); -- 2.30.2