From a0c2a2361bc99a4365ba22be30dcd0a2095d3251 Mon Sep 17 00:00:00 2001 From: Ryan Kennedy Date: Mon, 13 Apr 2020 03:14:03 -0500 Subject: [PATCH] Add some rectangles --- src/devices/bochs.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/devices/bochs.rs b/src/devices/bochs.rs index 22064cb..0e9d572 100644 --- a/src/devices/bochs.rs +++ b/src/devices/bochs.rs @@ -113,6 +113,17 @@ impl BochsDevice { } } + pub fn draw_rectangle(&self, rectangle: &Rectangle, color: u32) { + let p1 = (rectangle.left as isize, rectangle.top as isize); + let p2 = (rectangle.left as isize, rectangle.bottom as isize); + let p3 = (rectangle.right as isize, rectangle.bottom as isize); + let p4 = (rectangle.right as isize, rectangle.top as isize); + self.draw_line(p1, p2, color); + self.draw_line(p2, p3, color); + self.draw_line(p3, p4, color); + self.draw_line(p4, p1, color); + } + pub fn fill_rectangle(&self, rectangle: &Rectangle, color: u32) { for y in rectangle.top..rectangle.bottom { for x in rectangle.left..rectangle.right {