winit_manager: don't draw if resize is incomplete
This commit is contained in:
parent
7669fc0b70
commit
84ab4e1f03
|
@ -297,6 +297,7 @@ where
|
|||
factor: usize,
|
||||
queued_buf: QueuedBuf,
|
||||
recording: Option<RecordInfo>,
|
||||
awaiting_resize: bool,
|
||||
}
|
||||
|
||||
struct QueuedBuf {
|
||||
|
@ -379,6 +380,7 @@ where
|
|||
factor,
|
||||
queued_buf: Default::default(),
|
||||
recording,
|
||||
awaiting_resize: false,
|
||||
},
|
||||
sender,
|
||||
))
|
||||
|
@ -426,6 +428,7 @@ where
|
|||
|
||||
let real_width = (width as u32) * real_factor;
|
||||
let real_height = (height as u32) * real_factor;
|
||||
self.awaiting_resize = true;
|
||||
|
||||
if let Some(size) = self
|
||||
.window
|
||||
|
@ -436,6 +439,7 @@ where
|
|||
}
|
||||
|
||||
fn on_resize(&mut self, size: PhysicalSize<u32>) {
|
||||
self.awaiting_resize = false;
|
||||
let resolutions = ResolutionData {
|
||||
real_width: size.width,
|
||||
real_height: size.height,
|
||||
|
@ -451,6 +455,13 @@ where
|
|||
}
|
||||
|
||||
fn display(&mut self, buffer: Vec<[u8; 4]>) {
|
||||
if self.awaiting_resize {
|
||||
log::warn!(
|
||||
"window {}: received buffer before resize complete",
|
||||
self.window.title()
|
||||
);
|
||||
return;
|
||||
}
|
||||
self.queued_buf.update(buffer);
|
||||
|
||||
self.window.request_redraw();
|
||||
|
|
Loading…
Reference in a new issue