aboutsummaryrefslogtreecommitdiff
path: root/lvc/src/debug.rs
diff options
context:
space:
mode:
Diffstat (limited to 'lvc/src/debug.rs')
-rw-r--r--lvc/src/debug.rs24
1 files changed, 18 insertions, 6 deletions
diff --git a/lvc/src/debug.rs b/lvc/src/debug.rs
index 0e6fb7a..d6c37c2 100644
--- a/lvc/src/debug.rs
+++ b/lvc/src/debug.rs
@@ -8,7 +8,18 @@ pub fn draw_debug(frame: &mut Frame, view: View, block: &Block) {
draw_debug(frame, av, &a);
draw_debug(frame, bv, &b);
}
- Block::Ref(_r) => {}
+ Block::Ref(r) => {
+ let v = View {
+ a: view.a,
+ b: view.a + P2 { x: 2, y: 2 },
+ };
+ if r.pos_off != P2::ZERO {
+ fill_rect(frame, v + P2 { x: 0, y: 0 }, Pixel::BLUE)
+ }
+ if r.color_off != Pixel::BLACK {
+ fill_rect(frame, v + P2 { x: 2, y: 0 }, Pixel::RED)
+ }
+ }
}
}
@@ -22,9 +33,10 @@ fn rect(frame: &mut Frame, view: View, color: Pixel) {
frame[P2 { y, x: view.b.x - 1 }] = color;
}
}
-
-impl Pixel {
- pub const RED: Pixel = Pixel { r: 255, g: 0, b: 0 };
- pub const GREEN: Pixel = Pixel { r: 0, g: 255, b: 0 };
- pub const BLUE: Pixel = Pixel { r: 0, g: 0, b: 255 };
+fn fill_rect(frame: &mut Frame, view: View, color: Pixel) {
+ for y in view.a.y..view.b.y {
+ for x in view.a.x..view.b.x {
+ frame[P2 { x, y }] = color;
+ }
+ }
}