From 8cae3fca48e15a0f77f3b8ae3665b664fad33727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnther=20Jena?= Date: Wed, 21 May 2025 20:49:21 +0200 Subject: [PATCH] Fix `svg` scaling in `iced_tiny_skia` --- tiny_skia/src/engine.rs | 2 +- tiny_skia/src/vector.rs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index 57fe68d1..44c22be0 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -627,7 +627,7 @@ impl Engine { self.vector_pipeline.draw( &svg.handle, svg.color, - physical_bounds, + *bounds, svg.opacity, _pixels, transform, diff --git a/tiny_skia/src/vector.rs b/tiny_skia/src/vector.rs index ea7de215..0f4d736b 100644 --- a/tiny_skia/src/vector.rs +++ b/tiny_skia/src/vector.rs @@ -42,17 +42,20 @@ impl Pipeline { if let Some(image) = self.cache.borrow_mut().draw( handle, color, - Size::new(bounds.width as u32, bounds.height as u32), + Size::new( + (bounds.width * transform.sx) as u32, + (bounds.height * transform.sy) as u32, + ), ) { pixels.draw_pixmap( - bounds.x as i32, - bounds.y as i32, + (bounds.x * transform.sx) as i32, + (bounds.y * transform.sy) as i32, image, &tiny_skia::PixmapPaint { opacity, ..tiny_skia::PixmapPaint::default() }, - transform, + Transform::default(), clip_mask, ); }