File tree Expand file tree Collapse file tree 1 file changed +37
-11
lines changed Expand file tree Collapse file tree 1 file changed +37
-11
lines changed Original file line number Diff line number Diff line change @@ -61,17 +61,43 @@ impl Win32Impl {
61
61
62
62
pub ( crate ) unsafe fn set_buffer ( & mut self , buffer : & [ u32 ] , width : u16 , height : u16 ) {
63
63
// Create a new bitmap info struct.
64
- let mut bitmap_info: BitmapInfo = unsafe { mem:: zeroed ( ) } ;
65
-
66
- bitmap_info. bmi_header . biSize = mem:: size_of :: < BITMAPINFOHEADER > ( ) as u32 ;
67
- bitmap_info. bmi_header . biPlanes = 1 ;
68
- bitmap_info. bmi_header . biBitCount = 32 ;
69
- bitmap_info. bmi_header . biCompression = BI_BITFIELDS ;
70
- bitmap_info. bmi_header . biWidth = width as i32 ;
71
- bitmap_info. bmi_header . biHeight = -( height as i32 ) ;
72
- bitmap_info. bmi_colors [ 0 ] . rgbRed = 0xff ;
73
- bitmap_info. bmi_colors [ 1 ] . rgbGreen = 0xff ;
74
- bitmap_info. bmi_colors [ 2 ] . rgbBlue = 0xff ;
64
+ let bmi_header = BITMAPINFOHEADER {
65
+ biSize : mem:: size_of :: < BITMAPINFOHEADER > ( ) as u32 ,
66
+ biWidth : width as i32 ,
67
+ biHeight : -( height as i32 ) ,
68
+ biPlanes : 1 ,
69
+ biBitCount : 32 ,
70
+ biCompression : BI_BITFIELDS ,
71
+ biSizeImage : 0 ,
72
+ biXPelsPerMeter : 0 ,
73
+ biYPelsPerMeter : 0 ,
74
+ biClrUsed : 0 ,
75
+ biClrImportant : 0 ,
76
+ } ;
77
+ let zero_quad = RGBQUAD {
78
+ rgbBlue : 0 ,
79
+ rgbGreen : 0 ,
80
+ rgbRed : 0 ,
81
+ rgbReserved : 0 ,
82
+ } ;
83
+ let bmi_colors = [
84
+ RGBQUAD {
85
+ rgbRed : 0xff ,
86
+ ..zero_quad
87
+ } ,
88
+ RGBQUAD {
89
+ rgbGreen : 0xff ,
90
+ ..zero_quad
91
+ } ,
92
+ RGBQUAD {
93
+ rgbBlue : 0xff ,
94
+ ..zero_quad
95
+ } ,
96
+ ] ;
97
+ let bitmap_info = BitmapInfo {
98
+ bmi_header,
99
+ bmi_colors,
100
+ } ;
75
101
76
102
// Stretch the bitmap onto the window.
77
103
// SAFETY:
You can’t perform that action at this time.
0 commit comments