From: buliabyak Date: Sun, 19 Mar 2006 23:00:15 +0000 (+0000) Subject: fix clipping with unfilled paths X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b738a617199a775142a893ef2af1accf57dc5235;p=inkscape.git fix clipping with unfilled paths --- diff --git a/src/display/nr-arena-item.cpp b/src/display/nr-arena-item.cpp index e816460b9..3bdd88724 100644 --- a/src/display/nr-arena-item.cpp +++ b/src/display/nr-arena-item.cpp @@ -675,7 +675,7 @@ nr_arena_item_invoke_clip (NRArenaItem *item, NRRectL *area, NRPixBlock *pb) nr_return_val_if_fail ((pb->area.y1 - pb->area.y0) >= (area->y1 - area->y0), NR_ARENA_ITEM_STATE_INVALID); #ifdef NR_ARENA_ITEM_VERBOSE - printf ("Invoke render %p: %d %d - %d %d\n", item, area->x0, area->y0, area->x1, area->y1); + printf ("Invoke render %p: %d %d - %d %d, item bbox %d %d - %d %d\n", item, area->x0, area->y0, area->x1, area->y1, (&item->bbox)->x0, (&item->bbox)->y0, (&item->bbox)->x1, (&item->bbox)->y1); #endif if (item->visible && nr_rect_l_test_intersect (area, &item->bbox)) { diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 4fd381ad4..367555f6b 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -185,7 +185,7 @@ nr_arena_shape_set_child_position (NRArenaItem *item, NRArenaItem *child, NRAren } void nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc); -void nr_arena_shape_update_fill(NRArenaShape *shape,NRGC *gc); +void nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, bool force_shape = false); void nr_arena_shape_add_bboxes(NRArenaShape* shape,NRRect &bbox); static guint @@ -377,11 +377,12 @@ int matrix_is_isometry(NR::Matrix p) { return 0; } +/** force_shape is used for clipping paths, when we need the shape for clipping even if it's not filled */ void -nr_arena_shape_update_fill(NRArenaShape *shape,NRGC *gc) +nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, bool force_shape) { shape->delayed_shp = false; - if ((shape->_fill.paint.type() != NRArenaShape::Paint::NONE) && + if ((shape->_fill.paint.type() != NRArenaShape::Paint::NONE || force_shape) && ((shape->curve->end > 2) || (shape->curve->bpath[1].code == NR_CURVETO)) ) { if (TRUE || !shape->fill_shp) { NR::Matrix cached_to_new; @@ -424,6 +425,7 @@ nr_arena_shape_update_fill(NRArenaShape *shape,NRGC *gc) if ( shape->fill_shp == NULL ) shape->fill_shp=new Shape; + shape->fill_shp->Reset(shape->cached_fill->numberOfPoints(), shape->cached_fill->numberOfEdges()); for (int i = 0; i < shape->cached_fill->numberOfPoints(); i++) @@ -742,15 +744,14 @@ static guint nr_arena_shape_clip (NRArenaItem *item, NRRectL *area, NRPixBlock *pb) { NRArenaShape *shape = NR_ARENA_SHAPE (item); - if (!shape->curve) return item->state; if ( shape->delayed_shp ) { if ( nr_rect_l_test_intersect (area, &item->bbox) ) { NRGC tempGC(NULL); tempGC.transform=shape->ctm; - nr_arena_shape_update_stroke(shape,&tempGC); - nr_arena_shape_update_fill(shape,&tempGC); + //nr_arena_shape_update_stroke(shape,&tempGC); // we don't need stroke for clipping + nr_arena_shape_update_fill(shape, &tempGC, true); /* NRRect bbox; bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0; nr_arena_shape_add_bboxes(shape,bbox);