summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2016-02-27 14:59:01 +0000
committertavmjong-free <tavmjong@free.fr>2016-02-27 14:59:01 +0000
commitee541fdb5f3096cf4805563eca091173a70ddf9e (patch)
treecf37adecc379eddb55edd53be2527cf2d96ab0f6 /src
parentUI. Fix for bug #1351597 (Inkscape + Cairo >= 1.12 very slow on Windows, unle... (diff)
downloadinkscape-ee541fdb5f3096cf4805563eca091173a70ddf9e.tar.gz
inkscape-ee541fdb5f3096cf4805563eca091173a70ddf9e.zip
Fix miter-limit behavior to match SVG spec.
(bzr r14671)
Diffstat (limited to 'src')
-rw-r--r--src/helper/geom-pathstroke.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/helper/geom-pathstroke.cpp b/src/helper/geom-pathstroke.cpp
index 52871ae2a..3ef4b15da 100644
--- a/src/helper/geom-pathstroke.cpp
+++ b/src/helper/geom-pathstroke.cpp
@@ -163,7 +163,9 @@ void miter_join_internal(join_data jd, bool clip)
if (p.isFinite()) {
// check size of miter
Point point_on_path = incoming.finalPoint() + rot90(tang1)*width;
- satisfied = distance(p, point_on_path) <= miter * 2.0 * width;
+ // SVG defines miter length as distance between inner intersection and outer intersection,
+ // which is twice the distance from p to point_on_path but width is half stroke width.
+ satisfied = distance(p, point_on_path) <= miter * width;
if (satisfied) {
// miter OK, check to see if we can do a relocation
if (inc_ls) {
@@ -175,7 +177,7 @@ void miter_join_internal(join_data jd, bool clip)
// std::cout << " Clipping ------------ " << std::endl;
// miter needs clipping, find two points
Point bisector_versor = Line(point_on_path, p).versor();
- Point point_limit = point_on_path + miter * 2.0 * width * bisector_versor;
+ Point point_limit = point_on_path + miter * width * bisector_versor;
// std::cout << " bisector_versor: " << bisector_versor << std::endl;
// std::cout << " point_limit: " << point_limit << std::endl;
Point p1 = intersection_point(incoming.finalPoint(), tang1, point_limit, bisector_versor.cw());