From cb37d872ed7195e57268e0c3a1a76367039bf959 Mon Sep 17 00:00:00 2001 From: Tamas Csikel Date: Sun, 1 Nov 2026 20:04:40 +0100 Subject: [PATCH] sf-ui 0.1.2: fix the video flicker Glass's video fade stepped down whenever it was already at its target, so a fully shown video dipped every other frame. At 60 fps that was a 5 % dip; on a slow GPU (Raspberry Pi 4, ~10 fps during playback) the video went down to ~60 % every other frame and the backdrop flickered through. The fade now clamps to its target, like the picture fades do. Co-Authored-By: Claude Opus 5.5 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- sf-ui/src/glass.rs | 7 +++++-- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a0c20e..457a1df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4810,7 +4810,7 @@ dependencies = [ [[package]] name = "sf-app" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "log", @@ -4820,7 +4820,7 @@ dependencies = [ [[package]] name = "sf-pack" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "ruzstd", @@ -4832,7 +4832,7 @@ dependencies = [ [[package]] name = "sf-ui" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "glow 0.16.0", @@ -4848,7 +4848,7 @@ dependencies = [ [[package]] name = "sf-ui-gallery" -version = "0.1.1" +version = "0.1.2" dependencies = [ "anyhow", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index eb3c806..5f6d48d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["sf-app", "sf-ui", "sf-ui/gallery", "sf-pack"] exclude = ["templates/rust-app"] [workspace.package] -version = "0.1.1" +version = "0.1.2" edition = "2024" license = "MIT" repository = "https://gitea.bluefox.support/fennec/sdk" diff --git a/sf-ui/src/glass.rs b/sf-ui/src/glass.rs index c1b3371..b5ab6bf 100644 --- a/sf-ui/src/glass.rs +++ b/sf-ui/src/glass.rs @@ -434,11 +434,14 @@ impl State { keep }); + // Eases to the target and stays there. (It used to step down whenever + // it was already at the target: a fully shown video dipped every + // other frame, a visible flicker at a slow GPU's frame rate.) let target = if self.video_on { 1.0 } else { 0.0 }; self.video_alpha = if target > self.video_alpha { - (self.video_alpha + dt / 0.3).min(1.0) + (self.video_alpha + dt / 0.3).min(target) } else { - (self.video_alpha - dt / 0.3).max(0.0) + (self.video_alpha - dt / 0.3).max(target) }; if !self.video_on && self.video_alpha <= 0.0 { self.video = None;