From a50a56a29d7068b523bcbecd9313bbd5f165e447 Mon Sep 17 00:00:00 2001 From: Thomas Gatzweiler Date: Tue, 1 Apr 2025 13:29:33 +0200 Subject: [PATCH 1/2] fix(tiny-skia): correct stroke bounds calculation --- tiny_skia/src/engine.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tiny_skia/src/engine.rs b/tiny_skia/src/engine.rs index 44c22be0..8dc21b61 100644 --- a/tiny_skia/src/engine.rs +++ b/tiny_skia/src/engine.rs @@ -538,10 +538,10 @@ impl Engine { let bounds = path.bounds(); Rectangle { - x: bounds.x(), - y: bounds.y(), - width: bounds.width(), - height: bounds.height(), + x: bounds.x() - stroke.width / 2.0, + y: bounds.y() - stroke.width / 2.0, + width: bounds.width() + stroke.width, + height: bounds.height() + stroke.width, } * transformation }; From f931d555446a5c82fb344d17d58db7d2b8ded39e Mon Sep 17 00:00:00 2001 From: Thomas Gatzweiler Date: Tue, 1 Apr 2025 13:29:54 +0200 Subject: [PATCH 2/2] fix(tiny-skia): correct clip bounds transformation --- tiny_skia/src/layer.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index 5f3979bf..d39278b2 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -191,7 +191,7 @@ impl Layer { ) { self.primitives.push(Item::Group( primitives, - clip_bounds, + clip_bounds * transformation, transformation, )); } @@ -204,7 +204,7 @@ impl Layer { ) { self.primitives.push(Item::Cached( primitives, - clip_bounds, + clip_bounds * transformation, transformation, )); }