From e4b613c2c8a7ba0acc5a8ebd9b02864e400c115b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Tue, 26 Mar 2019 19:56:59 -0700 Subject: [PATCH] Stroke then transform instead of the reverse. --- svg/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/svg/src/lib.rs b/svg/src/lib.rs index ba96f02b..620cbf75 100644 --- a/svg/src/lib.rs +++ b/svg/src/lib.rs @@ -28,7 +28,7 @@ use usvg::{Color as SvgColor, Node, NodeExt, NodeKind, Paint as UsvgPaint}; use usvg::{PathSegment as UsvgPathSegment, Rect as UsvgRect, Transform as UsvgTransform}; use usvg::{Tree, Visibility}; -const HAIRLINE_STROKE_WIDTH: f32 = 0.1; +const HAIRLINE_STROKE_WIDTH: f32 = 0.0333; pub struct BuiltSVG { pub scene: Scene, @@ -135,12 +135,12 @@ impl BuiltSVG { f32::max(stroke.width.value() as f32, HAIRLINE_STROKE_WIDTH); let path = UsvgPathToSegments::new(path.segments.iter().cloned()); - let path = Transform2DF32PathIter::new(path, &transform); let outline = Outline::from_segments(path); let mut stroke_to_fill = OutlineStrokeToFill::new(outline, stroke_width); stroke_to_fill.offset(); - let outline = stroke_to_fill.outline; + let mut outline = stroke_to_fill.outline; + outline.transform(&transform); self.scene.bounds = self.scene.bounds.union_rect(outline.bounds()); self.scene.objects.push(PathObject::new(