perf(settings): coalesce refreshes and cache resize previews
This commit is contained in:
1 parent
6671960d5e
commit
81b99709bb
16 files changed
+906
-74
No files matched your search
@@ -1,5 +1,7 @@
|
||||
use cosmic::Element;
|
||||
use cosmic::iced::{Color, Length};
|
||||
use cosmic::iced::Color;
|
||||
#[cfg(test)]
|
||||
use cosmic::iced::Length;
|
||||
use cosmic::widget::icon as svg_icon;
|
||||
pub use ferese_theme::Palette;
|
||||
pub const PAGE_TITLE_SIZE: f32 = 16.;
|
||||
@@ -109,6 +111,7 @@ pub fn color(value: &str, fallback: Color) -> Color {
|
||||
ferese_theme::parse_color(value).unwrap_or(fallback)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn hex(c: Color) -> String {
|
||||
format!(
|
||||
"#{:02x}{:02x}{:02x}",
|
||||
@@ -118,10 +121,6 @@ fn hex(c: Color) -> String {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn native_theme(_snapshot: Option<&Snapshot>) -> cosmic::Theme {
|
||||
Palette::from_resolved(&ferese_theme_client::service::current().presented).native_theme()
|
||||
}
|
||||
|
||||
pub fn icon(page: Page, tint: Color) -> svg_icon::Icon {
|
||||
ferese_theme::icons::outline(page.icon(), tint, 19)
|
||||
}
|
||||
@@ -311,11 +310,20 @@ pub fn preview_resolved<'a>(
|
||||
snapshot: &Snapshot,
|
||||
theme: &ferese_config::theme::ResolvedTheme,
|
||||
) -> Element<'a, Message> {
|
||||
crate::window_preview::view(snapshot, theme)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
pub(super) fn legacy_preview_resolved(
|
||||
snapshot: &Snapshot,
|
||||
theme: &ferese_config::theme::ResolvedTheme,
|
||||
) -> Element<'static, Message> {
|
||||
let mut snapshot = snapshot.clone();
|
||||
snapshot.doc = snapshot.doc.with_theme(theme);
|
||||
preview(&snapshot, theme)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
fn preview(
|
||||
snapshot: &Snapshot,
|
||||
theme: &ferese_config::theme::ResolvedTheme,
|
||||
|
||||
Reference in new issue
Block a user