File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
uefi-test-runner/examples Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,23 @@ impl Buffer {
5555 dims : ( self . width , self . height ) ,
5656 } )
5757 }
58+
59+ /// Update only a pixel to the framebuffer.
60+ fn blit_pixel (
61+ & self ,
62+ gop : & mut GraphicsOutput ,
63+ coords : ( usize , usize ) ,
64+ ) -> Result {
65+ gop. blt ( BltOp :: BufferToVideo {
66+ buffer : & self . pixels ,
67+ src : BltRegion :: SubRectangle {
68+ coords,
69+ px_stride : self . width ,
70+ } ,
71+ dest : coords,
72+ dims : ( 1 , 1 ) ,
73+ } )
74+ }
5875}
5976// ANCHOR_END: buffer
6077
@@ -90,6 +107,9 @@ fn draw_sierpinski(bt: &BootServices) -> Result {
90107 }
91108 }
92109
110+ // Draw background.
111+ buffer. blit ( & mut gop) ?;
112+
93113 let size = Point :: new ( width as f32 , height as f32 ) ;
94114
95115 // Define the vertices of a big triangle.
@@ -119,7 +139,7 @@ fn draw_sierpinski(bt: &BootServices) -> Result {
119139 pixel. blue = 0 ;
120140
121141 // Draw the buffer to the screen.
122- buffer. blit ( & mut gop) ?;
142+ buffer. blit_pixel ( & mut gop, ( p . x as usize , p . y as usize ) ) ?;
123143 }
124144}
125145
You can’t perform that action at this time.
0 commit comments