🐛 Fix wasm glitches

This commit is contained in:
Alejandro Alonso 2025-02-12 10:21:17 +01:00 committed by Aitor Moreno
parent 26a2ef8fb7
commit 64e6d0b1f8
5 changed files with 68 additions and 14 deletions

View file

@ -1,6 +1,18 @@
use super::{Image, Viewbox};
use skia::Contains;
use skia_safe as skia;
pub(crate) struct CachedSurfaceImage {
pub image: Image,
pub viewbox: Viewbox,
pub invalid: bool,
pub has_all_shapes: bool,
}
impl CachedSurfaceImage {
pub fn invalidate_if_dirty(&mut self, viewbox: &Viewbox) {
if !self.has_all_shapes && !self.viewbox.area.contains(viewbox.area) {
self.invalid = true;
}
}
}