mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
alternate XOR pattern for busy-bar
this it to avoid abusing the primitive to create inverted text (for secure UI elements only). It does degrade from the aesthetics of a busy bar but it is a computationally efficient way to patch around the concern.
This commit is contained in:
parent
6a3e9f1584
commit
50ef03e319
3 changed files with 16 additions and 6 deletions
|
|
@ -34,4 +34,4 @@ debugprint = []
|
||||||
braille = []
|
braille = []
|
||||||
gfx-testing = []
|
gfx-testing = []
|
||||||
ditherpunk = []
|
ditherpunk = []
|
||||||
default = []
|
default = ["gfx-testing"]
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,11 @@ pub fn rectangle(fb: &mut LcdFB, rect: Rectangle, clip: Option<Rectangle>, xor:
|
||||||
// This is to make it annoying for someone using an XOR rectangle to synthesize inverted
|
// This is to make it annoying for someone using an XOR rectangle to synthesize inverted
|
||||||
// text on an otherwise untrusted dialog box (I suspect it's not impossible, but introduces
|
// text on an otherwise untrusted dialog box (I suspect it's not impossible, but introduces
|
||||||
// a likelihood of drawing artifacts especially across translations and font size selections).
|
// a likelihood of drawing artifacts especially across translations and font size selections).
|
||||||
xor_pixel(fb, pixel.0.x, pixel.0.y);
|
if pixel.0.y % 20 < 10 {
|
||||||
|
xor_pixel(fb, pixel.0.x, pixel.0.y);
|
||||||
|
} else {
|
||||||
|
// don't allow XOR on some pixels to avoid this being used as a primitive to synthesize secure boxes
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log::warn!("invalid xor rect width");
|
log::warn!("invalid xor rect width");
|
||||||
put_pixel(fb, pixel.0.x, pixel.0.y, pixel.1);
|
put_pixel(fb, pixel.0.x, pixel.0.y, pixel.1);
|
||||||
|
|
|
||||||
|
|
@ -62,10 +62,16 @@ pub fn tests() {
|
||||||
tv.insertion = None;
|
tv.insertion = None;
|
||||||
tv.draw_border = false;
|
tv.draw_border = false;
|
||||||
tv.busy_animation_state = Some(0);
|
tv.busy_animation_state = Some(0);
|
||||||
for _ in 0..4800 {
|
for y in 0..30 {
|
||||||
gfx.draw_textview(&mut tv).unwrap();
|
gfx.draw_rectangle(checkbound).unwrap();
|
||||||
gfx.flush().unwrap();
|
tv.bounds_hint = TextBounds::BoundingBox(Rectangle::new_coords(
|
||||||
ticktimer.sleep_ms(100).unwrap();
|
10, 10 + y, 240, 30 + y
|
||||||
|
));
|
||||||
|
for _ in 0..5 {
|
||||||
|
gfx.draw_textview(&mut tv).unwrap();
|
||||||
|
gfx.flush().unwrap();
|
||||||
|
ticktimer.sleep_ms(100).unwrap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(TestType::BoundingBox) => {
|
Some(TestType::BoundingBox) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue