From: buliabyak Date: Sat, 4 Nov 2006 21:59:07 +0000 (+0000) Subject: fix bug: stroke width was not changed when switching to outline and back X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3df7a1fc502f17953828b6fff559fb9dbe18d47f;p=inkscape.git fix bug: stroke width was not changed when switching to outline and back --- diff --git a/src/display/nr-arena-shape.cpp b/src/display/nr-arena-shape.cpp index 357245667..8c4b42577 100644 --- a/src/display/nr-arena-shape.cpp +++ b/src/display/nr-arena-shape.cpp @@ -494,9 +494,13 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area) ((shape->_stroke.paint.type() != NRArenaShape::Paint::NONE) && ( fabs(shape->_stroke.width * scale) > 0.01 ))) { // sinon c'est 0=oon veut pas de bord - float width = MAX(0.125, shape->_stroke.width * scale); - if (outline) + float style_width = MAX(0.125, shape->_stroke.width * scale); + float width; + if (outline) { width = 0.5; // 1 pixel wide, independent of zoom + } else { + width = style_width; + } NR::Matrix cached_to_new = NR::identity(); @@ -510,6 +514,10 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area) } if (0 != isometry && !is_inner_area(shape->cached_sarea, *area)) isometry = 0; + if (0 != isometry && width != shape->cached_width) { + // if this happens without setting style, we have just switched to outline or back + isometry = 0; + } } if ( isometry == 0 ) { @@ -582,6 +590,8 @@ nr_arena_shape_update_stroke(NRArenaShape *shape,NRGC* gc, NRRectL *area) shape->cached_stroke->ConvertToShape(theShape, fill_nonZero); } + shape->cached_width = width; + shape->cached_sctm=gc->transform; shape->cached_sarea = *area; delete thePath; diff --git a/src/display/nr-arena-shape.h b/src/display/nr-arena-shape.h index cd72013f6..782ae127a 100644 --- a/src/display/nr-arena-shape.h +++ b/src/display/nr-arena-shape.h @@ -122,6 +122,8 @@ struct NRArenaShape : public NRArenaItem { // the 2 cached polygons, for rasterizations uses Shape *fill_shp; Shape *stroke_shp; + // the stroke width of stroke_shp, to detect when it changes (on normal/outline switching) and rebuild + float cached_width; // delayed_shp=true means the *_shp polygons are not computed yet // they'll be computed on demand in *_render(), *_pick() or *_clip() // the goal is to not uncross polygons that are outside the viewing region