always use latest frame
This commit is contained in:
parent
e2f1f13ba2
commit
11dec11079
|
@ -114,22 +114,18 @@ fn init_pixbuf(info: WindowInfo, window: &mut Window) -> (Pixels, usize) {
|
|||
impl WindowHandler for EmulatorWindow {
|
||||
fn on_frame(&mut self, _window: &mut Window) {
|
||||
if let Some(ref mut receiver) = *self.frame_receiver.lock().expect("failed to lock mutex") {
|
||||
match receiver.recv() {
|
||||
Ok(buf) => {
|
||||
if let Some(buf) = receiver.try_iter().last() {
|
||||
let scaled_buf = if self.scale != 1 {
|
||||
scale_buffer(&buf, WIDTH, HEIGHT, self.scale)
|
||||
} else {
|
||||
buf
|
||||
};
|
||||
for (pixel, source) in
|
||||
self.pix.get_frame_mut().chunks_exact_mut(4).zip(scaled_buf)
|
||||
for (pixel, source) in self.pix.get_frame_mut().chunks_exact_mut(4).zip(scaled_buf)
|
||||
{
|
||||
pixel.copy_from_slice(&source);
|
||||
}
|
||||
self.pix.render().unwrap();
|
||||
}
|
||||
Err(e) => nih_log!("recv error: {e}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue