Code

fix bug: stroke width was not changed when switching to outline and back
authorbuliabyak <buliabyak@users.sourceforge.net>
Sat, 4 Nov 2006 21:59:07 +0000 (21:59 +0000)
committerbuliabyak <buliabyak@users.sourceforge.net>
Sat, 4 Nov 2006 21:59:07 +0000 (21:59 +0000)
src/display/nr-arena-shape.cpp
src/display/nr-arena-shape.h

index 357245667682cdce73caf6cb143c271b280ac7c8..8c4b42577b00fceaca3f423b4eb75e10e08ca20c 100644 (file)
@@ -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;
index cd72013f6d2cab12e063309addcb84f01bc8e148..782ae127a0acd019ae562205ea68ef9e72b41ba9 100644 (file)
@@ -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