File tree 1 file changed +21
-1
lines changed
uefi-test-runner/examples
1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,23 @@ impl Buffer {
55
55
dims : ( self . width , self . height ) ,
56
56
} )
57
57
}
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
+ }
58
75
}
59
76
// ANCHOR_END: buffer
60
77
@@ -90,6 +107,9 @@ fn draw_sierpinski(bt: &BootServices) -> Result {
90
107
}
91
108
}
92
109
110
+ // Draw background.
111
+ buffer. blit ( & mut gop) ?;
112
+
93
113
let size = Point :: new ( width as f32 , height as f32 ) ;
94
114
95
115
// Define the vertices of a big triangle.
@@ -119,7 +139,7 @@ fn draw_sierpinski(bt: &BootServices) -> Result {
119
139
pixel. blue = 0 ;
120
140
121
141
// 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 ) ) ?;
123
143
}
124
144
}
125
145
You can’t perform that action at this time.
0 commit comments