diff options
author | 2024-04-10 20:23:07 +0200 | |
---|---|---|
committer | 2024-04-10 20:23:07 +0200 | |
commit | 1e8554bf02f366b18b31b9ea1dfb150f7935ca06 (patch) | |
tree | 95333a49013ab5a17d2232791b339386fa432384 /tiny_skia | |
parent | fdd9896dc5f727f4c659ad6252f1ab36cca77762 (diff) | |
download | iced-1e8554bf02f366b18b31b9ea1dfb150f7935ca06.tar.gz iced-1e8554bf02f366b18b31b9ea1dfb150f7935ca06.tar.bz2 iced-1e8554bf02f366b18b31b9ea1dfb150f7935ca06.zip |
Sort damage by distance from origin in `iced_graphics::damage`
Diffstat (limited to 'tiny_skia')
-rw-r--r-- | tiny_skia/src/layer.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs index d3d8b988..ec87c2bf 100644 --- a/tiny_skia/src/layer.rs +++ b/tiny_skia/src/layer.rs @@ -213,16 +213,14 @@ impl Layer { ¤t.primitives, |item| match item { Item::Live(primitive) => vec![primitive.visible_bounds()], - Item::Group(primitives, bounds, transformation) => { - damage::group( - primitives - .as_slice() - .iter() - .map(Primitive::visible_bounds) - .map(|bounds| bounds * *transformation) - .collect(), - *bounds, - ) + Item::Group(primitives, group_bounds, transformation) => { + primitives + .as_slice() + .iter() + .map(Primitive::visible_bounds) + .map(|bounds| bounds * *transformation) + .filter_map(|bounds| bounds.intersection(group_bounds)) + .collect() } Item::Cached(_, bounds, _) => { vec![*bounds] |