mirror of
https://github.com/rust-windowing/winit.git
synced 2026-09-02 06:40:06 -04:00
Remove indentation in fill.rs helper
This commit is contained in:
@@ -7,16 +7,6 @@
|
|||||||
//! The `softbuffer` crate is used, largely because of its ease of use. `glutin` or `wgpu` could
|
//! The `softbuffer` crate is used, largely because of its ease of use. `glutin` or `wgpu` could
|
||||||
//! also be used to fill the window buffer, but they are more complicated to use.
|
//! also be used to fill the window buffer, but they are more complicated to use.
|
||||||
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub use platform::cleanup_window;
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub use platform::fill_window;
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub use platform::fill_window_with_animated_color;
|
|
||||||
#[allow(unused_imports)]
|
|
||||||
pub use platform::fill_window_with_color;
|
|
||||||
|
|
||||||
mod platform {
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
@@ -52,9 +42,7 @@ mod platform {
|
|||||||
fn new(w: &dyn Window) -> Self {
|
fn new(w: &dyn Window) -> Self {
|
||||||
Self {
|
Self {
|
||||||
context: RefCell::new(
|
context: RefCell::new(
|
||||||
Context::new(unsafe {
|
Context::new(unsafe { mem::transmute::<&'_ dyn Window, &'static dyn Window>(w) })
|
||||||
mem::transmute::<&'_ dyn Window, &'static dyn Window>(w)
|
|
||||||
})
|
|
||||||
.expect("Failed to create a softbuffer context"),
|
.expect("Failed to create a softbuffer context"),
|
||||||
),
|
),
|
||||||
surfaces: HashMap::new(),
|
surfaces: HashMap::new(),
|
||||||
@@ -89,8 +77,7 @@ mod platform {
|
|||||||
|
|
||||||
// Either get the last context used or create a new one.
|
// Either get the last context used or create a new one.
|
||||||
let mut gc = gc.borrow_mut();
|
let mut gc = gc.borrow_mut();
|
||||||
let surface =
|
let surface = gc.get_or_insert_with(|| GraphicsContext::new(window)).create_surface(window);
|
||||||
gc.get_or_insert_with(|| GraphicsContext::new(window)).create_surface(window);
|
|
||||||
|
|
||||||
// Fill a buffer with a solid color
|
// Fill a buffer with a solid color
|
||||||
|
|
||||||
@@ -126,4 +113,3 @@ mod platform {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user