Skip to content

Commit 9b8641f

Browse files
committed
Make new function take both a HasRawWindowHandle and a HasRawDisplayHandle object
1 parent e781cd8 commit 9b8641f

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use winit::window::WindowBuilder;
6363
fn main() {
6464
let event_loop = EventLoop::new();
6565
let window = WindowBuilder::new().build(&event_loop).unwrap();
66-
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
66+
let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap();
6767
6868
event_loop.run(move |event, _, control_flow| {
6969
*control_flow = ControlFlow::Wait;

examples/animation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn main() {
2525
.unwrap();
2626
}
2727

28-
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
28+
let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap();
2929

3030
let mut old_size = (0, 0);
3131
let mut frames = pre_render_frames(0, 0);

examples/fruit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn main() {
3232
.unwrap();
3333
}
3434

35-
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
35+
let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap();
3636

3737
event_loop.run(move |event, _, control_flow| {
3838
*control_flow = ControlFlow::Wait;

examples/winit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn main() {
2121
.unwrap();
2222
}
2323

24-
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
24+
let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap();
2525

2626
event_loop.run(move |event, _, control_flow| {
2727
*control_flow = ControlFlow::Wait;

examples/winit_wrong_sized_buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ fn main() {
2424
.unwrap();
2525
}
2626

27-
let mut graphics_context = unsafe { GraphicsContext::new(&window) }.unwrap();
27+
let mut graphics_context = unsafe { GraphicsContext::new(&window, &window) }.unwrap();
2828

2929
event_loop.run(move |event, _, control_flow| {
3030
*control_flow = ControlFlow::Wait;

src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ pub struct GraphicsContext {
3333
}
3434

3535
impl GraphicsContext {
36-
/// Creates a new instance of this struct, using the provided window.
36+
/// Creates a new instance of this struct, using the provided window and display.
3737
///
3838
/// # Safety
3939
///
40-
/// - Ensure that the provided window is valid to draw a 2D buffer to, and is valid for the
40+
/// - Ensure that the provided objects are valid to draw a 2D buffer to, and are valid for the
4141
/// lifetime of the GraphicsContext
42-
pub unsafe fn new<W: HasRawWindowHandle + HasRawDisplayHandle>(window: &W) -> Result<Self, SwBufError> {
43-
Self::from_raw(window.raw_window_handle(), window.raw_display_handle())
42+
pub unsafe fn new<W: HasRawWindowHandle, D: HasRawDisplayHandle>(window: &W, display: &D) -> Result<Self, SwBufError> {
43+
Self::from_raw(window.raw_window_handle(), display.raw_display_handle())
4444
}
4545

46-
/// Creates a new instance of this struct, using the provided raw handles
46+
/// Creates a new instance of this struct, using the provided raw window and display handles
4747
///
4848
/// # Safety
4949
///

0 commit comments

Comments
 (0)