From 6d8e2666989ea26e25fb601152c868246cd836c7 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 10 May 2023 06:29:45 -0700 Subject: [PATCH] fixup setting background layer(s) to solid colors This is a regression caused by recent work such as 27fbff4ae18770594d5b22f337fe02c5d90ccb5b This config wouldn't set the background color to red because we'd never consider the frame to be loaded: ```lua local wezterm = require 'wezterm' local config = wezterm.config_builder() config.background = { { source = { Color = '#FF0000' }, width = '100%', height = '100%' }, } return config ``` --- wezterm-gui/src/glyphcache.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/wezterm-gui/src/glyphcache.rs b/wezterm-gui/src/glyphcache.rs index d7cbfab10..db9437cd1 100644 --- a/wezterm-gui/src/glyphcache.rs +++ b/wezterm-gui/src/glyphcache.rs @@ -489,14 +489,6 @@ impl DecodedImage { } } - fn load_state(&self) -> LoadState { - let frames = self.frames.borrow(); - match frames.as_ref() { - Some(state) => state.load_state, - None => LoadState::Loading, - } - } - fn start_frame_decoder(lease: BlobLease, image_data: &Arc) -> Self { match FrameDecoder::start(lease.clone()) { Ok(rx) => Self { @@ -879,12 +871,12 @@ impl GlyphCache { match &*handle.h { ImageDataType::Rgba8 { hash, .. } => { if let Some(sprite) = frame_cache.get(hash) { - return Ok((sprite.clone(), None, decoded.load_state())); + return Ok((sprite.clone(), None, LoadState::Loaded)); } let sprite = atlas.allocate_with_padding(&handle, padding)?; frame_cache.insert(*hash, sprite.clone()); - return Ok((sprite, None, decoded.load_state())); + return Ok((sprite, None, LoadState::Loaded)); } ImageDataType::AnimRgba8 { hashes, @@ -932,7 +924,7 @@ impl GlyphCache { let hash = hashes[*decoded_current_frame]; if let Some(sprite) = frame_cache.get(&hash) { - return Ok((sprite.clone(), next, decoded.load_state())); + return Ok((sprite.clone(), next, LoadState::Loaded)); } let sprite = atlas.allocate_with_padding(&handle, padding)?; @@ -945,7 +937,7 @@ impl GlyphCache { *decoded_frame_start + durations[*decoded_current_frame].max(min_frame_duration), ), - decoded.load_state(), + LoadState::Loaded, )); } ImageDataType::EncodedLease(_) | ImageDataType::EncodedFile(_) => {