1
1
use crate :: { GraphicsContextImpl , SwBufError } ;
2
2
use raw_window_handle:: { HasRawWindowHandle , Win32WindowHandle } ;
3
3
use std:: os:: raw:: c_int;
4
- use winapi:: shared:: windef:: { HDC , HWND } ;
5
- use winapi:: um:: wingdi:: { StretchDIBits , BITMAPINFOHEADER , BI_BITFIELDS , RGBQUAD } ;
6
- use winapi:: um:: winuser:: { GetDC , ValidateRect } ;
4
+
5
+ use windows_sys:: Win32 :: Foundation :: HWND ;
6
+ use windows_sys:: Win32 :: Graphics :: Gdi :: {
7
+ StretchDIBits , BITMAPINFOHEADER , BI_BITFIELDS , RGBQUAD , HDC ,
8
+ ValidateRect , GetDC , SRCCOPY , DIB_RGB_COLORS ,
9
+ } ;
7
10
8
11
pub struct Win32Impl {
9
12
window : HWND ,
@@ -22,7 +25,7 @@ impl Win32Impl {
22
25
pub unsafe fn new < W : HasRawWindowHandle > ( handle : & Win32WindowHandle ) -> Result < Self , crate :: SwBufError < W > > {
23
26
let dc = GetDC ( handle. hwnd as HWND ) ;
24
27
25
- if dc. is_null ( ) {
28
+ if dc == 0 {
26
29
return Err ( SwBufError :: PlatformError ( Some ( "Device Context is null" . into ( ) ) , None ) ) ;
27
30
}
28
31
@@ -61,8 +64,8 @@ impl GraphicsContextImpl for Win32Impl {
61
64
height as c_int ,
62
65
std:: mem:: transmute ( buffer. as_ptr ( ) ) ,
63
66
std:: mem:: transmute ( & bitmap_info) ,
64
- winapi :: um :: wingdi :: DIB_RGB_COLORS ,
65
- winapi :: um :: wingdi :: SRCCOPY ,
67
+ DIB_RGB_COLORS ,
68
+ SRCCOPY ,
66
69
) ;
67
70
68
71
ValidateRect ( self . window , std:: ptr:: null_mut ( ) ) ;
0 commit comments