Merge pull request #2977 from DKolter/issue_2934

Fix tiny skia primitive rendering
This commit is contained in:
Héctor 2025-11-27 04:41:16 +01:00 committed by GitHub
commit b3e1be5def
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 41 deletions

View file

@ -36,15 +36,6 @@ impl Engine {
clip_mask: &mut tiny_skia::Mask,
clip_bounds: Rectangle,
) {
debug_assert!(
quad.bounds.width.is_normal(),
"Quad with non-normal width!"
);
debug_assert!(
quad.bounds.height.is_normal(),
"Quad with non-normal height!"
);
let physical_bounds = quad.bounds * transformation;
if !clip_bounds.intersects(&physical_bounds) {
@ -497,7 +488,7 @@ impl Engine {
transformation: Transformation,
pixels: &mut tiny_skia::PixmapMut<'_>,
clip_mask: &mut tiny_skia::Mask,
layer_bounds: Rectangle,
clip_bounds: Rectangle,
) {
match primitive {
Primitive::Fill { path, paint, rule } => {
@ -512,14 +503,12 @@ impl Engine {
} * transformation
};
let Some(clip_bounds) =
layer_bounds.intersection(&physical_bounds)
else {
if !clip_bounds.intersects(&physical_bounds) {
return;
};
}
let clip_mask =
(physical_bounds != clip_bounds).then_some(clip_mask as &_);
let clip_mask = (!physical_bounds.is_within(&clip_bounds))
.then_some(clip_mask as &_);
pixels.fill_path(
path,
@ -545,14 +534,12 @@ impl Engine {
} * transformation
};
let Some(clip_bounds) =
layer_bounds.intersection(&physical_bounds)
else {
if !clip_bounds.intersects(&physical_bounds) {
return;
};
}
let clip_mask =
(physical_bounds != clip_bounds).then_some(clip_mask as &_);
let clip_mask = (!physical_bounds.is_within(&clip_bounds))
.then_some(clip_mask as &_);
pixels.stroke_path(
path,