mirror of
https://github.com/penpot/penpot.git
synced 2026-04-26 03:38:18 +00:00
20 lines
482 B
Rust
20 lines
482 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 has_all_shapes: bool,
|
|
}
|
|
|
|
impl CachedSurfaceImage {
|
|
pub fn is_dirty_for_zooming(&mut self, viewbox: &Viewbox) -> bool {
|
|
!self.has_all_shapes && !self.viewbox.area.contains(viewbox.area)
|
|
}
|
|
|
|
pub fn is_dirty_for_panning(&mut self, _viewbox: &Viewbox) -> bool {
|
|
!self.has_all_shapes
|
|
}
|
|
}
|