Files
penpot/render-wasm/src/render/cache.rs
Alejandro Alonso 64e6d0b1f8 🐛 Fix wasm glitches
2025-02-13 15:16:45 +01:00

19 lines
435 B
Rust

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;
}
}
}