diff --git a/integrations/vello_svg/src/lib.rs b/integrations/vello_svg/src/lib.rs index 312c747..894f812 100644 --- a/integrations/vello_svg/src/lib.rs +++ b/integrations/vello_svg/src/lib.rs @@ -64,7 +64,10 @@ pub fn render_tree_with Result<(), E mut on_err: F, ) -> Result<(), E> { for elt in svg.root.descendants() { - let transform = elt.abs_transform(); + let transform = { + let usvg::Transform { a, b, c, d, e, f } = elt.abs_transform(); + Affine::new([a, b, c, d, e, f]) + }; match &*elt.borrow() { usvg::NodeKind::Group(_) => {} usvg::NodeKind::Path(path) => { @@ -72,7 +75,7 @@ pub fn render_tree_with Result<(), E // The semantics of SVG paths don't line up with `BezPath`; we must manually track initial points let mut just_closed = false; let mut most_recent_initial = (0., 0.); - for elt in usvg::TransformedPath::new(&path.data, transform) { + for elt in path.data.segments() { match elt { usvg::PathSegment::MoveTo { x, y } => { if std::mem::take(&mut just_closed) { @@ -112,7 +115,7 @@ pub fn render_tree_with Result<(), E if let Some(fill) = &path.fill { if let Some(brush) = paint_to_brush(&fill.paint, fill.opacity) { // FIXME: Set the fill rule - sb.fill(Fill::NonZero, Affine::IDENTITY, &brush, None, &local_path); + sb.fill(Fill::NonZero, transform, &brush, None, &local_path); } else { on_err(sb, &elt)?; } @@ -122,7 +125,7 @@ pub fn render_tree_with Result<(), E // FIXME: handle stroke options such as linecap, linejoin, etc. sb.stroke( &Stroke::new(stroke.width.get() as f32), - Affine::IDENTITY, + transform, &brush, None, &local_path,