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:
@@ -487,20 +487,20 @@ impl ModuleImpl for PulseAudio {
|
||||
Color::new(1.0, 1.0, 1.0, 1.0)
|
||||
};
|
||||
self.font.draw_text(
|
||||
&mut buf.subdimensions((0, 0, 128, 24))?,
|
||||
buf,
|
||||
bg,
|
||||
&Color::new(1.0, 1.0, 1.0, 1.0),
|
||||
"volume",
|
||||
)?;
|
||||
draw_bar(&mut buf.subdimensions((128, 0, 464, 24))?, &c, 464, 24, vol)?;
|
||||
draw_bar(&mut buf.offset((128, 0))?, &c, 464, 24, vol)?;
|
||||
let mut iter = 1.0;
|
||||
while vol > 1.0 {
|
||||
let c = &Color::new(0.75 / iter, 0.25 / iter, 0.25 / iter, 1.0);
|
||||
vol -= 1.0;
|
||||
iter += 1.0;
|
||||
draw_bar(&mut buf.subdimensions((128, 0, 464, 24))?, &c, 464, 24, vol)?;
|
||||
draw_bar(&mut buf.offset((128, 0))?, &c, 464, 24, vol)?;
|
||||
}
|
||||
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()])
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user