Simplify buffer positioning, introduce WLDASH_SCALE

Replace most uses of Buffer::subdimensions with Buffer::offset.

Introduce WLDASH_SCALE. Set to 2 to make wldash render at half size.
This commit is contained in:
Kenny Levinsen
2019-09-03 13:24:21 +02:00
parent 2bad68a8cf
commit 3b4c9267bb
11 changed files with 75 additions and 41 deletions
+3 -3
View File
@@ -108,19 +108,19 @@ impl ModuleImpl for Backlight {
buf.memset(bg);
let c = Color::new(1.0, 1.0, 1.0, 1.0);
self.font.draw_text(
&mut buf.subdimensions((0, 0, 128, 24))?,
buf,
bg,
&c,
"backlight",
)?;
draw_bar(
&mut buf.subdimensions((128, 0, 464, 24))?,
&mut buf.offset((128, 0))?,
&c,
464,
24,
self.brightness(),
)?;
draw_box(&mut buf.subdimensions((128, 0, 464, 24))?, &c, (464, 24))?;
draw_box(&mut buf.offset((128, 0))?, &c, (464, 24))?;
Ok(vec![buf.get_signed_bounds()])
}