Add fill_screen

This commit is contained in:
Daniel Beckwith 2020-03-31 18:22:55 -04:00
parent 44c3821d9d
commit 8eb86d55a1

View file

@ -87,6 +87,21 @@ pub trait TextWriter: Screen {
} }
} }
/// Fills the screen by setting all cells to `b' '` with the given color.
fn fill_screen(&self, color: TextModeColor) {
let (_vga, frame_buffer) = self.get_frame_buffer();
let character = ScreenCharacter {
character: b' ',
color,
};
let screen_size = self.get_width() * self.get_height();
for i in 0..screen_size {
unsafe {
frame_buffer.add(i).write_volatile(character);
}
}
}
/// Disables the cursor in vga text modes. /// Disables the cursor in vga text modes.
fn disable_cursor(&self) { fn disable_cursor(&self) {
let (mut vga, _frame_buffer) = self.get_frame_buffer(); let (mut vga, _frame_buffer) = self.get_frame_buffer();