tiling: Don't completely empty buffer in animation

Previously, this would lead to flickering if the decoder was too slow.
Now, the last frame will be shown until a new one is available.

Closes #382
This commit is contained in:
Sophie Herold 2024-07-17 14:01:37 +02:00
parent 9b56f30c3b
commit c2df5586c1
2 changed files with 8 additions and 7 deletions

View file

@ -159,7 +159,7 @@
{
"type": "git",
"url": "https://gitlab.gnome.org/sophie-h/glycin.git",
"commit": "4b0759839322fad9277c7f823438abe4937e4027"
"commit": "9701eb7ac36cd85ce75241bf50dfe325b50f54c9"
}
]
},

View file

@ -648,10 +648,11 @@ impl SharedFrameBuffer {
/// Return true if the next frame should be shown and removes the outdated
/// frame
pub fn frame_timeout(&self, elapsed: Duration) -> bool {
if self
.buffer
.load()
.images
let images = &self.buffer.load().images;
// Only move to next image if there is one buffered
if images.len() > 1
&& images
.front()
.is_some_and(|next_frame| elapsed >= next_frame.delay)
{