From: buliabyak Date: Fri, 13 Apr 2007 01:33:31 +0000 (+0000) Subject: fix thinning that didn't work for paths inside a transformed group X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9750c2b6fc6843862effd2be59402193fe7171a1;p=inkscape.git fix thinning that didn't work for paths inside a transformed group --- diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp index ad8d18442..6925960ea 100644 --- a/src/dyna-draw-context.cpp +++ b/src/dyna-draw-context.cpp @@ -669,10 +669,11 @@ sp_ddc_dilate (SPDynaDrawContext *dc, NR::Point p, bool expand) } bool did_this = false; + NR::Matrix i2doc(sp_item_i2doc_affine(item)); if (theShape->MakeOffset(theRes, - expand? offset : -offset, - join_straight, butt_straight, - true, p[NR::X], p[NR::Y], radius) == 0) // 0 means the shape was actually changed + expand? offset : -offset, + join_straight, butt_straight, + true, p[NR::X], p[NR::Y], radius, &i2doc) == 0) // 0 means the shape was actually changed did_this = true; // the rest only makes sense if we actually changed the path diff --git a/src/livarot/Shape.h b/src/livarot/Shape.h index 42069f623..80a4d8c09 100644 --- a/src/livarot/Shape.h +++ b/src/livarot/Shape.h @@ -281,7 +281,7 @@ public: // create a graph that is an offseted version of the graph "of" // the offset is dec, with joins between edges of type "join" (see LivarotDefs.h) // the result is NOT a polygon; you need a subsequent call to ConvertToShape to get a real polygon - int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0); + int MakeOffset(Shape *of, double dec, JoinType join, double miter, bool do_profile=false, double cx = 0, double cy = 0, double radius = 0, NR::Matrix *i2doc = NULL); int PtWinding(const NR::Point px) const; // plus rapide int Winding(const NR::Point px) const; diff --git a/src/livarot/ShapeMisc.cpp b/src/livarot/ShapeMisc.cpp index ec93d1d90..b269c1c9c 100644 --- a/src/livarot/ShapeMisc.cpp +++ b/src/livarot/ShapeMisc.cpp @@ -528,7 +528,7 @@ Shape::ConvertToFormeNested (Path * dest, int nbP, Path * *orig, int wildPath,in // you gotta be very careful with the join, as anything but the right one will fuck everything up // see PathStroke.cpp for the "right" joins int -Shape::MakeOffset (Shape * a, double dec, JoinType join, double miter, bool do_profile, double cx, double cy, double radius) +Shape::MakeOffset (Shape * a, double dec, JoinType join, double miter, bool do_profile, double cx, double cy, double radius, NR::Matrix *i2doc) { Reset (0, 0); MakeBackData(a->_has_back_data); @@ -606,9 +606,9 @@ Shape::MakeOffset (Shape * a, double dec, JoinType join, double miter, bool do_p ptP = a->getPoint(a->getEdge(i).st).x; double this_dec; - if (do_profile) { + if (do_profile && i2doc) { double alpha = 1; - double x = (NR::L2(ptP - NR::Point(cx,cy))/radius); + double x = (NR::L2(ptP * (*i2doc) - NR::Point(cx,cy))/radius); if (x > 1) { this_dec = 0; } else if (x <= 0) {