From 33695286793e32e2709550aa4081f6aff4dc352d Mon Sep 17 00:00:00 2001 From: Krishna Ayyalasomayajula Date: Sat, 30 May 2026 20:03:47 -0500 Subject: [PATCH] docs: fix resize() signature mismatch between call site and definition --- docs/01-rainbow-triangle.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/01-rainbow-triangle.md b/docs/01-rainbow-triangle.md index 9a931ab..b82aefa 100644 --- a/docs/01-rainbow-triangle.md +++ b/docs/01-rainbow-triangle.md @@ -143,7 +143,7 @@ impl ApplicationHandler<()> for App { let Some(window) = self.window.as_ref() else { return }; match event { - WindowEvent::Resized(size) => state.resize(window, size), + WindowEvent::Resized(size) => state.resize(size), WindowEvent::CloseRequested { .. } => event_loop_ctl.exit(), WindowEvent::RedrawRequested => { state.render(); @@ -1250,8 +1250,9 @@ returns. ### When `resize` Is Called In our `App::window_event` handler (S2), the `WindowEvent::Resized(size)` arm -calls `state.resize(window, size)`. The resize fires once for every dimension -change. On fast window resizing, you may receive dozens of resize events in +calls `state.resize(size)`. Since `State` owns an `Arc` (see S3), +`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 discards old buffers and allocates new ones. The GPU continues processing in-flight frames with the old buffer dimensions; there is no visual glitch