docs: fix resize() signature mismatch between call site and definition
This commit is contained in:
@@ -143,7 +143,7 @@ impl ApplicationHandler<()> for App {
|
|||||||
let Some(window) = self.window.as_ref() else { return };
|
let Some(window) = self.window.as_ref() else { return };
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::Resized(size) => state.resize(window, size),
|
WindowEvent::Resized(size) => state.resize(size),
|
||||||
WindowEvent::CloseRequested { .. } => event_loop_ctl.exit(),
|
WindowEvent::CloseRequested { .. } => event_loop_ctl.exit(),
|
||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
state.render();
|
state.render();
|
||||||
@@ -1250,8 +1250,9 @@ returns.
|
|||||||
### When `resize` Is Called
|
### When `resize` Is Called
|
||||||
|
|
||||||
In our `App::window_event` handler (S2), the `WindowEvent::Resized(size)` arm
|
In our `App::window_event` handler (S2), the `WindowEvent::Resized(size)` arm
|
||||||
calls `state.resize(window, size)`. The resize fires once for every dimension
|
calls `state.resize(size)`. Since `State` owns an `Arc<Window>` (see S3),
|
||||||
change. On fast window resizing, you may receive dozens of resize events in
|
`resize()` has access to the window internally and needs only the new
|
||||||
|
dimension. The resize fires once for every dimension change. On fast window resizing, you may receive dozens of resize events in
|
||||||
succession. `surface.configure()` is fast enough to handle this — each call
|
succession. `surface.configure()` is fast enough to handle this — each call
|
||||||
discards old buffers and allocates new ones. The GPU continues processing
|
discards old buffers and allocates new ones. The GPU continues processing
|
||||||
in-flight frames with the old buffer dimensions; there is no visual glitch
|
in-flight frames with the old buffer dimensions; there is no visual glitch
|
||||||
|
|||||||
Reference in New Issue
Block a user