@@ -33,7 +33,7 @@ use crate::{Completion, Result, Status};
3333/// The GOP can be used to set the properties of the frame buffer,
3434/// and also allows the app to access the in-memory buffer.
3535#[ repr( C ) ]
36- pub struct GraphicsOutput {
36+ pub struct GraphicsOutput < ' boot > {
3737 query_mode :
3838 extern "win64" fn ( & GraphicsOutput , mode : u32 , info_sz : & mut usize , & mut * const ModeInfo )
3939 -> Status ,
@@ -42,7 +42,7 @@ pub struct GraphicsOutput {
4242 #[ allow( clippy:: type_complexity) ]
4343 blt : extern "win64" fn (
4444 this : & mut GraphicsOutput ,
45- buffer : usize ,
45+ buffer : * mut BltPixel ,
4646 op : u32 ,
4747 source_x : usize ,
4848 source_y : usize ,
@@ -52,18 +52,18 @@ pub struct GraphicsOutput {
5252 height : usize ,
5353 stride : usize ,
5454 ) -> Status ,
55- mode : & ' static ModeData ,
55+ mode : & ' boot ModeData < ' boot > ,
5656}
5757
58- impl GraphicsOutput {
58+ impl < ' boot > GraphicsOutput < ' boot > {
5959 /// Returns information for an available graphics mode that the graphics
6060 /// device and the set of active video output devices supports.
6161 fn query_mode ( & self , index : u32 ) -> Result < Mode > {
6262 let mut info_sz = 0 ;
6363 let mut info = ptr:: null ( ) ;
6464
6565 ( self . query_mode ) ( self , index, & mut info_sz, & mut info) . into_with ( || {
66- let info = unsafe { & * info } ;
66+ let info = unsafe { * info } ;
6767 Mode {
6868 index,
6969 info_sz,
@@ -103,7 +103,7 @@ impl GraphicsOutput {
103103 self . check_framebuffer_region ( ( dest_x, dest_y) , ( width, height) ) ;
104104 ( self . blt ) (
105105 self ,
106- & color as * const _ as usize ,
106+ & color as * const _ as * mut _ ,
107107 0 ,
108108 0 ,
109109 0 ,
@@ -126,7 +126,7 @@ impl GraphicsOutput {
126126 match dest_region {
127127 BltRegion :: Full => ( self . blt ) (
128128 self ,
129- buffer. as_mut_ptr ( ) as usize ,
129+ buffer. as_mut_ptr ( ) ,
130130 1 ,
131131 src_x,
132132 src_y,
@@ -142,7 +142,7 @@ impl GraphicsOutput {
142142 px_stride,
143143 } => ( self . blt ) (
144144 self ,
145- buffer. as_mut_ptr ( ) as usize ,
145+ buffer. as_mut_ptr ( ) ,
146146 1 ,
147147 src_x,
148148 src_y,
@@ -166,7 +166,7 @@ impl GraphicsOutput {
166166 match src_region {
167167 BltRegion :: Full => ( self . blt ) (
168168 self ,
169- buffer. as_ptr ( ) as usize ,
169+ buffer. as_ptr ( ) as * mut _ ,
170170 2 ,
171171 0 ,
172172 0 ,
@@ -182,7 +182,7 @@ impl GraphicsOutput {
182182 px_stride,
183183 } => ( self . blt ) (
184184 self ,
185- buffer. as_ptr ( ) as usize ,
185+ buffer. as_ptr ( ) as * mut _ ,
186186 2 ,
187187 src_x,
188188 src_y,
@@ -203,7 +203,16 @@ impl GraphicsOutput {
203203 self . check_framebuffer_region ( ( src_x, src_y) , ( width, height) ) ;
204204 self . check_framebuffer_region ( ( dest_x, dest_y) , ( width, height) ) ;
205205 ( self . blt ) (
206- self , 0usize , 3 , src_x, src_y, dest_x, dest_y, width, height, 0 ,
206+ self ,
207+ ptr:: null_mut ( ) ,
208+ 3 ,
209+ src_x,
210+ src_y,
211+ dest_x,
212+ dest_y,
213+ width,
214+ height,
215+ 0 ,
207216 )
208217 . into ( )
209218 }
@@ -269,19 +278,19 @@ impl GraphicsOutput {
269278}
270279
271280impl_proto ! {
272- protocol GraphicsOutput {
281+ protocol GraphicsOutput < ' boot> {
273282 GUID = 0x9042a9de , 0x23dc , 0x4a38 , [ 0x96 , 0xfb , 0x7a , 0xde , 0xd0 , 0x80 , 0x51 , 0x6a ] ;
274283 }
275284}
276285
277286#[ repr( C ) ]
278- struct ModeData {
287+ struct ModeData < ' a > {
279288 // Number of modes which the GOP supports.
280289 max_mode : u32 ,
281290 // Current mode.
282291 mode : u32 ,
283292 // Information about the current mode.
284- info : & ' static ModeInfo ,
293+ info : & ' a ModeInfo ,
285294 // Size of the above structure.
286295 info_sz : usize ,
287296 // Physical address of the frame buffer.
@@ -329,7 +338,7 @@ pub struct PixelBitmask {
329338pub struct Mode {
330339 index : u32 ,
331340 info_sz : usize ,
332- info : & ' static ModeInfo ,
341+ info : ModeInfo ,
333342}
334343
335344impl Mode {
@@ -342,7 +351,7 @@ impl Mode {
342351
343352 /// Returns a reference to the mode info structure.
344353 pub fn info ( & self ) -> & ModeInfo {
345- self . info
354+ & self . info
346355 }
347356}
348357
@@ -391,7 +400,7 @@ impl ModeInfo {
391400
392401/// Iterator for graphics modes.
393402struct ModeIter < ' a > {
394- gop : & ' a GraphicsOutput ,
403+ gop : & ' a GraphicsOutput < ' a > ,
395404 current : u32 ,
396405 max : u32 ,
397406}
0 commit comments