Skip to content

Commit

Permalink
tiny_skia: fix incorrect shadow clipping (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney authored Jan 7, 2025
1 parent cf29084 commit 8e13065
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tiny_skia/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,17 @@ impl Engine {
quad.bounds.height.is_normal(),
"Quad with non-normal height!"
);
let physical_bounds_with_shadow = quad.bounds_with_shadow() * transformation;

let physical_bounds = quad.bounds * transformation;

if !clip_bounds.intersects(&physical_bounds) {
if !clip_bounds.intersects(&physical_bounds_with_shadow) {
return;
}

let clip_mask = (!physical_bounds.is_within(&clip_bounds))
let clip_mask = (!physical_bounds_with_shadow.is_within(&clip_bounds))
.then_some(clip_mask as &_);

let physical_bounds = quad.bounds * transformation;

let transform = into_transform(transformation);

// Make sure the border radius is not larger than the bounds
Expand Down

0 comments on commit 8e13065

Please sign in to comment.