minor optimization for single-frame animated formats

Use 1-day duration for the single frame when an animated
format yields only a single frame.
This commit is contained in:
Wez Furlong committed 2023-03-20 10:14:17 -07:00
1 parent 829e5c15cf
commit 001a49be4c
1 file changed
+6
+6
View File
@@ -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
}