@@ -8,18 +8,20 @@ pub unsafe fn test() {
8
8
info ! ( "Running graphics output protocol test" ) ;
9
9
let handle =
10
10
boot:: get_handle_for_protocol :: < GraphicsOutput > ( ) . expect ( "missing GraphicsOutput protocol" ) ;
11
- let gop = & mut boot:: open_protocol :: < GraphicsOutput > (
12
- OpenProtocolParams {
13
- handle,
14
- agent : boot:: image_handle ( ) ,
15
- controller : None ,
16
- } ,
17
- // For this test, don't open in exclusive mode. That
18
- // would break the connection between stdout and the
19
- // video console.
20
- OpenProtocolAttributes :: GetProtocol ,
21
- )
22
- . expect ( "failed to open Graphics Output Protocol" ) ;
11
+ let gop = unsafe {
12
+ & mut boot:: open_protocol :: < GraphicsOutput > (
13
+ OpenProtocolParams {
14
+ handle,
15
+ agent : boot:: image_handle ( ) ,
16
+ controller : None ,
17
+ } ,
18
+ // For this test, don't open in exclusive mode. That
19
+ // would break the connection between stdout and the
20
+ // video console.
21
+ OpenProtocolAttributes :: GetProtocol ,
22
+ )
23
+ . expect ( "failed to open Graphics Output Protocol" )
24
+ } ;
23
25
24
26
set_graphics_mode ( gop) ;
25
27
fill_color ( gop) ;
@@ -73,10 +75,10 @@ fn draw_fb(gop: &mut GraphicsOutput) {
73
75
74
76
type PixelWriter = unsafe fn ( & mut FrameBuffer , usize , [ u8 ; 3 ] ) ;
75
77
unsafe fn write_pixel_rgb ( fb : & mut FrameBuffer , pixel_base : usize , rgb : [ u8 ; 3 ] ) {
76
- fb. write_value ( pixel_base, rgb) ;
78
+ unsafe { fb. write_value ( pixel_base, rgb) }
77
79
}
78
80
unsafe fn write_pixel_bgr ( fb : & mut FrameBuffer , pixel_base : usize , rgb : [ u8 ; 3 ] ) {
79
- fb. write_value ( pixel_base, [ rgb[ 2 ] , rgb[ 1 ] , rgb[ 0 ] ] ) ;
81
+ unsafe { fb. write_value ( pixel_base, [ rgb[ 2 ] , rgb[ 1 ] , rgb[ 0 ] ] ) }
80
82
}
81
83
let write_pixel: PixelWriter = match mi. pixel_format ( ) {
82
84
PixelFormat :: Rgb => write_pixel_rgb,
0 commit comments