Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfe794c7

Browse files
committed
uefi-test-runner: speed up ploting of sierpinski triangle by updating changed pixel only
Signed-off-by: Jeff Li <lijinfeng01@ieisystem.com>
1 parentcfd63fb commitfe794c7

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎uefi-test-runner/examples/sierpinski.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff 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+
fnblit_pixel(
61+
&self,
62+
gop:&mutGraphicsOutput,
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(widthasf32, heightasf32);
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.xasusize, p.yasusize))?;
123143
}
124144
}
125145

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp