mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-16 08:38:26 +00:00
kind of hack to make font rendering work on oled displays
so, there is a fundamental abstraction mismatch in the blitstr library. In Precursor, I created a rule that you can't draw text on black backgrounds without some special permissions in highly trusted contexts. For baosec, this restriction is removed because the whole OS can run inside a single chip (i.e. we have eliminated most easy RAM modification attacks, requires probing/glitching; but as a trade-off, we don't have as much RAM so we can't afford the extra abstractions). The compromise is for OLED-type platforms where inverse drawing is very common to save power, all text ops are assumed to be XOR operations (so you're always flipping pixels instead of drawing at a defined color).
This commit is contained in:
parent
1a2d6bf772
commit
3c5975715d
1 changed files with 13 additions and 11 deletions
|
|
@ -160,18 +160,20 @@ impl ComposedType {
|
|||
let cr =
|
||||
ClipRect::new(clip_rect.tl().x, clip_rect.tl().y, clip_rect.br().x, clip_rect.br().y);
|
||||
let rawbuf = unsafe { frbuf.raw_mut() };
|
||||
if glyph.large {
|
||||
blitstr2::xor_glyph_large(
|
||||
rawbuf,
|
||||
(maybe_x, maybe_y),
|
||||
glyph,
|
||||
glyph.invert ^ invert,
|
||||
cr,
|
||||
);
|
||||
} else if !glyph.double {
|
||||
blitstr2::xor_glyph(rawbuf, (maybe_x, maybe_y), glyph, glyph.invert ^ invert, cr);
|
||||
let char_invert = if cfg!(feature = "hosted-baosec") || cfg!(feature = "board-baosec") {
|
||||
// OLED display background is black for power savings, so all polarities of drawing
|
||||
// need to be allowed
|
||||
true
|
||||
} else {
|
||||
blitstr2::xor_glyph_2x(rawbuf, (maybe_x, maybe_y), glyph, glyph.invert ^ invert, cr);
|
||||
glyph.invert ^ invert
|
||||
};
|
||||
|
||||
if glyph.large {
|
||||
blitstr2::xor_glyph_large(rawbuf, (maybe_x, maybe_y), glyph, char_invert, cr);
|
||||
} else if !glyph.double {
|
||||
blitstr2::xor_glyph(rawbuf, (maybe_x, maybe_y), glyph, char_invert, cr);
|
||||
} else {
|
||||
blitstr2::xor_glyph_2x(rawbuf, (maybe_x, maybe_y), glyph, char_invert, cr);
|
||||
}
|
||||
// Platform-dependent cursor inversion because the color scheme for sh1107 doesn't comply
|
||||
// to precursor norms
|
||||
|
|
|
|||
Loading…
Reference in a new issue