We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39950aa commit cacdcecCopy full SHA for cacdcec
1 file changed
tiny_skia/src/window/compositor.rs
@@ -168,11 +168,14 @@ pub fn present<T: AsRef<str>>(
168
.map_err(|_| compositor::SurfaceError::Lost)?;
169
170
let age = buffer.age();
171
- if age != 0 {
172
- while surface.primitives.len() as u8 > age {
173
- let _ = surface.primitives.pop_front();
174
- }
+
+ // Forget primatives for back buffers older than `age`
+ // Or if this is a new buffer, keep at most two.
+ let max = if age == 0 { 2 } else { age };
175
+ while surface.primitives.len() as u8 > max {
176
+ let _ = surface.primitives.pop_front();
177
}
178
179
let last_primitives = if surface.primitives.len() as u8 == age {
180
surface.primitives.pop_front()
181
} else {
0 commit comments