mirror of
https://github.com/penpot/penpot.git
synced 2026-03-21 18:03:47 +00:00
35 lines
881 B
Rust
35 lines
881 B
Rust
use crate::options;
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Default)]
|
|
pub struct RenderOptions {
|
|
pub flags: u32,
|
|
pub dpr: Option<f32>,
|
|
}
|
|
|
|
impl RenderOptions {
|
|
pub fn is_debug_visible(&self) -> bool {
|
|
self.flags & options::DEBUG_VISIBLE == options::DEBUG_VISIBLE
|
|
}
|
|
|
|
pub fn is_profile_rebuild_tiles(&self) -> bool {
|
|
self.flags & options::PROFILE_REBUILD_TILES == options::PROFILE_REBUILD_TILES
|
|
}
|
|
|
|
/// Use fast mode to enable / disable expensive operations
|
|
pub fn is_fast_mode(&self) -> bool {
|
|
self.flags & options::FAST_MODE == options::FAST_MODE
|
|
}
|
|
|
|
pub fn set_fast_mode(&mut self, enabled: bool) {
|
|
if enabled {
|
|
self.flags |= options::FAST_MODE;
|
|
} else {
|
|
self.flags &= !options::FAST_MODE;
|
|
}
|
|
}
|
|
|
|
pub fn dpr(&self) -> f32 {
|
|
self.dpr.unwrap_or(1.0)
|
|
}
|
|
}
|