summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-06-16 14:21:39 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-06-16 14:21:39 +0000
commit392887ed9fe04d1f032a7e65ea414cb309dd4c39 (patch)
tree149e61e3238a106d96b7d024a6e4bfe0459170d0 /src
parentFixed NPE (diff)
downloadinkscape-392887ed9fe04d1f032a7e65ea414cb309dd4c39.tar.gz
inkscape-392887ed9fe04d1f032a7e65ea414cb309dd4c39.zip
Fix nr_arena_shape_add_bboxes to what it was in the past. (the NPE was caused by wrong copypaste of me...)
(bzr r5951)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-arena-shape.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp
index 4b7ceed27..4d03f879f 100644
--- a/src/display/nr-arena-shape.cpp
+++ b/src/display/nr-arena-shape.cpp
@@ -664,24 +664,28 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area)
void
nr_arena_shape_add_bboxes(NRArenaShape* shape, Geom::Rect &bbox)
{
+ /* TODO: are these two if's mutually exclusive? ( i.e. "shape->stroke_shp <=> !shape->fill_shp" )
+ * if so, then this can be written much more compact ! */
+
if ( shape->stroke_shp ) {
- shape->stroke_shp->CalcBBox();
- shape->stroke_shp->leftX=floor(shape->stroke_shp->leftX);
- shape->stroke_shp->rightX=ceil(shape->stroke_shp->rightX);
- shape->stroke_shp->topY=floor(shape->stroke_shp->topY);
- shape->stroke_shp->bottomY=ceil(shape->stroke_shp->bottomY);
- Geom::Rect stroke_bbox( Geom::Interval(shape->stroke_shp->leftX, shape->stroke_shp->rightX),
- Geom::Interval(shape->stroke_shp->topY, shape->stroke_shp->bottomY) );
+ Shape *larger = shape->stroke_shp;
+ larger->CalcBBox();
+ larger->leftX = floor(larger->leftX);
+ larger->rightX = ceil(larger->rightX);
+ larger->topY = floor(larger->topY);
+ larger->bottomY = ceil(larger->bottomY);
+ Geom::Rect stroke_bbox( Geom::Interval(larger->leftX, larger->rightX),
+ Geom::Interval(larger->topY, larger->bottomY) );
bbox.unionWith(stroke_bbox);
}
if ( shape->fill_shp ) {
- shape->fill_shp->CalcBBox();
- shape->fill_shp->leftX=floor(shape->fill_shp->leftX);
- shape->fill_shp->rightX=ceil(shape->fill_shp->rightX);
- shape->fill_shp->topY=floor(shape->fill_shp->topY);
- shape->fill_shp->bottomY=ceil(shape->fill_shp->bottomY);
- Shape *larger = shape->stroke_shp ? shape->stroke_shp : shape->fill_shp;
+ Shape *larger = shape->fill_shp;
+ larger->CalcBBox();
+ larger->leftX = floor(larger->leftX);
+ larger->rightX = ceil(larger->rightX);
+ larger->topY = floor(larger->topY);
+ larger->bottomY = ceil(larger->bottomY);
Geom::Rect fill_bbox( Geom::Interval(larger->leftX, larger->rightX),
Geom::Interval(larger->topY, larger->bottomY) );
bbox.unionWith(fill_bbox);