@@ -33,7 +33,7 @@ use crate::{Completion, Result, Status};
33
33
/// The GOP can be used to set the properties of the frame buffer,
34
34
/// and also allows the app to access the in-memory buffer.
35
35
#[ repr( C ) ]
36
- pub struct GraphicsOutput {
36
+ pub struct GraphicsOutput < ' boot > {
37
37
query_mode :
38
38
extern "win64" fn ( & GraphicsOutput , mode : u32 , info_sz : & mut usize , & mut * const ModeInfo )
39
39
-> Status ,
@@ -42,7 +42,7 @@ pub struct GraphicsOutput {
42
42
#[ allow( clippy:: type_complexity) ]
43
43
blt : extern "win64" fn (
44
44
this : & mut GraphicsOutput ,
45
- buffer : usize ,
45
+ buffer : * mut BltPixel ,
46
46
op : u32 ,
47
47
source_x : usize ,
48
48
source_y : usize ,
@@ -52,18 +52,18 @@ pub struct GraphicsOutput {
52
52
height : usize ,
53
53
stride : usize ,
54
54
) -> Status ,
55
- mode : & ' static ModeData ,
55
+ mode : & ' boot ModeData < ' boot > ,
56
56
}
57
57
58
- impl GraphicsOutput {
58
+ impl < ' boot > GraphicsOutput < ' boot > {
59
59
/// Returns information for an available graphics mode that the graphics
60
60
/// device and the set of active video output devices supports.
61
61
fn query_mode ( & self , index : u32 ) -> Result < Mode > {
62
62
let mut info_sz = 0 ;
63
63
let mut info = ptr:: null ( ) ;
64
64
65
65
( self . query_mode ) ( self , index, & mut info_sz, & mut info) . into_with ( || {
66
- let info = unsafe { & * info } ;
66
+ let info = unsafe { * info } ;
67
67
Mode {
68
68
index,
69
69
info_sz,
@@ -103,7 +103,7 @@ impl GraphicsOutput {
103
103
self . check_framebuffer_region ( ( dest_x, dest_y) , ( width, height) ) ;
104
104
( self . blt ) (
105
105
self ,
106
- & color as * const _ as usize ,
106
+ & color as * const _ as * mut _ ,
107
107
0 ,
108
108
0 ,
109
109
0 ,
@@ -126,7 +126,7 @@ impl GraphicsOutput {
126
126
match dest_region {
127
127
BltRegion :: Full => ( self . blt ) (
128
128
self ,
129
- buffer. as_mut_ptr ( ) as usize ,
129
+ buffer. as_mut_ptr ( ) ,
130
130
1 ,
131
131
src_x,
132
132
src_y,
@@ -142,7 +142,7 @@ impl GraphicsOutput {
142
142
px_stride,
143
143
} => ( self . blt ) (
144
144
self ,
145
- buffer. as_mut_ptr ( ) as usize ,
145
+ buffer. as_mut_ptr ( ) ,
146
146
1 ,
147
147
src_x,
148
148
src_y,
@@ -166,7 +166,7 @@ impl GraphicsOutput {
166
166
match src_region {
167
167
BltRegion :: Full => ( self . blt ) (
168
168
self ,
169
- buffer. as_ptr ( ) as usize ,
169
+ buffer. as_ptr ( ) as * mut _ ,
170
170
2 ,
171
171
0 ,
172
172
0 ,
@@ -182,7 +182,7 @@ impl GraphicsOutput {
182
182
px_stride,
183
183
} => ( self . blt ) (
184
184
self ,
185
- buffer. as_ptr ( ) as usize ,
185
+ buffer. as_ptr ( ) as * mut _ ,
186
186
2 ,
187
187
src_x,
188
188
src_y,
@@ -203,7 +203,16 @@ impl GraphicsOutput {
203
203
self . check_framebuffer_region ( ( src_x, src_y) , ( width, height) ) ;
204
204
self . check_framebuffer_region ( ( dest_x, dest_y) , ( width, height) ) ;
205
205
( 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 ,
207
216
)
208
217
. into ( )
209
218
}
@@ -269,19 +278,19 @@ impl GraphicsOutput {
269
278
}
270
279
271
280
impl_proto ! {
272
- protocol GraphicsOutput {
281
+ protocol GraphicsOutput < ' boot> {
273
282
GUID = 0x9042a9de , 0x23dc , 0x4a38 , [ 0x96 , 0xfb , 0x7a , 0xde , 0xd0 , 0x80 , 0x51 , 0x6a ] ;
274
283
}
275
284
}
276
285
277
286
#[ repr( C ) ]
278
- struct ModeData {
287
+ struct ModeData < ' a > {
279
288
// Number of modes which the GOP supports.
280
289
max_mode : u32 ,
281
290
// Current mode.
282
291
mode : u32 ,
283
292
// Information about the current mode.
284
- info : & ' static ModeInfo ,
293
+ info : & ' a ModeInfo ,
285
294
// Size of the above structure.
286
295
info_sz : usize ,
287
296
// Physical address of the frame buffer.
@@ -329,7 +338,7 @@ pub struct PixelBitmask {
329
338
pub struct Mode {
330
339
index : u32 ,
331
340
info_sz : usize ,
332
- info : & ' static ModeInfo ,
341
+ info : ModeInfo ,
333
342
}
334
343
335
344
impl Mode {
@@ -342,7 +351,7 @@ impl Mode {
342
351
343
352
/// Returns a reference to the mode info structure.
344
353
pub fn info ( & self ) -> & ModeInfo {
345
- self . info
354
+ & self . info
346
355
}
347
356
}
348
357
@@ -391,7 +400,7 @@ impl ModeInfo {
391
400
392
401
/// Iterator for graphics modes.
393
402
struct ModeIter < ' a > {
394
- gop : & ' a GraphicsOutput ,
403
+ gop : & ' a GraphicsOutput < ' a > ,
395
404
current : u32 ,
396
405
max : u32 ,
397
406
}
0 commit comments