Skip to content

Commit 1f83f1f

Browse files
committed
fix: don't offset fill of quad
1 parent 46fc5a7 commit 1f83f1f

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

tiny_skia/src/backend.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -178,21 +178,14 @@ impl Backend {
178178
.min(bounds.width / 2.0)
179179
.min(bounds.height / 2.0);
180180

181-
// Offset the fill by the border width
182-
let path_bounds = Rectangle {
183-
x: bounds.x + border_width,
184-
y: bounds.y + border_width,
185-
width: bounds.width - 2.0 * border_width,
186-
height: bounds.height - 2.0 * border_width,
187-
};
188181
// fill border radius is the border radius minus the border width
189182
let mut fill_border_radius = *border_radius;
190183
for radius in &mut fill_border_radius {
191-
*radius = (*radius - border_width / 2.0)
192-
.min(path_bounds.width / 2.0)
193-
.min(path_bounds.height / 2.0);
184+
*radius = (*radius)
185+
.min(bounds.width / 2.0)
186+
.min(bounds.height / 2.0);
194187
}
195-
let path = rounded_rectangle(path_bounds, fill_border_radius);
188+
let path = rounded_rectangle(*bounds, fill_border_radius);
196189

197190
pixels.fill_path(
198191
&path,

0 commit comments

Comments
 (0)