From 001a49be4c5bdfa9bfa4a84bb0281f9c73f4bd57 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 20 Mar 2023 10:14:17 -0700 Subject: [PATCH] minor optimization for single-frame animated formats Use 1-day duration for the single frame when an animated format yields only a single frame. --- wezterm-gui/src/glyphcache.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rs index 4652802b0..c34f97048 100644 --- a/wezterm-gui/src/glyphcache.rs +++ b/wezterm-gui/src/glyphcache.rs @@ -384,6 +384,12 @@ impl FrameState { self.current_frame.duration = Duration::from_secs(86400); self.frames.push(self.current_frame.clone()); false + } else if self.frames.len() == 1 { + // If there's only a single frame, we may as well ensure + // that it has a long duration so that we don't waste + // resources ticking to the same frame over and over + self.frames[0].duration = Duration::from_secs(86400); + true } else { true }