diff --git a/examples/control_flow.rs b/examples/control_flow.rs index 47a518c181..1eb5b9cb1d 100644 --- a/examples/control_flow.rs +++ b/examples/control_flow.rs @@ -114,7 +114,7 @@ impl ApplicationHandler for ControlFlowDemo { WindowEvent::RedrawRequested => { let window = self.window.as_ref().unwrap(); window.pre_present_notify(); - fill::fill_window(window.as_ref()); + fill::fill_window(window.as_ref(), 0xff181818); }, _ => (), } diff --git a/examples/pump_events.rs b/examples/pump_events.rs index 3ec8abe38b..a32564dab7 100644 --- a/examples/pump_events.rs +++ b/examples/pump_events.rs @@ -43,7 +43,7 @@ fn main() -> std::process::ExitCode { match event { WindowEvent::CloseRequested => event_loop.exit(), WindowEvent::RedrawRequested => { - fill::fill_window(window.as_ref()); + fill::fill_window(window.as_ref(), 0xff181818); window.request_redraw(); }, _ => (), diff --git a/examples/run_on_demand.rs b/examples/run_on_demand.rs index e6d105ad5e..3c0e8e3c0f 100644 --- a/examples/run_on_demand.rs +++ b/examples/run_on_demand.rs @@ -69,7 +69,7 @@ fn main() -> Result<(), Box> { self.window = None; }, WindowEvent::RedrawRequested => { - fill::fill_window(window.as_ref()); + fill::fill_window(window.as_ref(), 0xff181818); }, _ => (), } diff --git a/examples/util/fill.rs b/examples/util/fill.rs index c93dfc5861..8e371e3474 100644 --- a/examples/util/fill.rs +++ b/examples/util/fill.rs @@ -70,7 +70,7 @@ mod platform { } } - pub fn fill_window(window: &dyn Window) { + pub fn fill_window(window: &dyn Window, color: u32) { GC.with(|gc| { let size = window.surface_size(); let (Some(width), Some(height)) = @@ -84,13 +84,12 @@ mod platform { let surface = gc.get_or_insert_with(|| GraphicsContext::new(window)).create_surface(window); - // Fill a buffer with a solid color. - const DARK_GRAY: u32 = 0xff181818; + // Fill a buffer with a solid color surface.resize(width, height).expect("Failed to resize the softbuffer surface"); let mut buffer = surface.buffer_mut().expect("Failed to get the softbuffer buffer"); - buffer.fill(DARK_GRAY); + buffer.fill(color); buffer.present().expect("Failed to present the softbuffer buffer"); }) } diff --git a/examples/x11_embed.rs b/examples/x11_embed.rs index 1b9a796ff6..8807412fd3 100644 --- a/examples/x11_embed.rs +++ b/examples/x11_embed.rs @@ -38,7 +38,7 @@ fn main() -> Result<(), Box> { WindowEvent::CloseRequested => event_loop.exit(), WindowEvent::RedrawRequested => { window.pre_present_notify(); - fill::fill_window(window.as_ref()); + fill::fill_window(window.as_ref(), 0xff181818); }, _ => (), }