mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-08 22:52:27 -04:00
invert display option (#2232)
* invert display option * text fix, format code
This commit is contained in:
parent
e6afd7744d
commit
87069f11e5
9 changed files with 65 additions and 15 deletions
|
@ -163,7 +163,10 @@ class IO {
|
|||
|
||||
void lcd_write_pixel(ui::Color pixel) {
|
||||
if (get_dark_cover()) {
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
if (!get_is_inverted())
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
else
|
||||
pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness());
|
||||
}
|
||||
lcd_write_data(pixel.v);
|
||||
}
|
||||
|
@ -174,7 +177,10 @@ class IO {
|
|||
|
||||
void lcd_write_pixels(ui::Color pixel, size_t n) {
|
||||
if (get_dark_cover()) {
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
if (!get_is_inverted())
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
else
|
||||
pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness());
|
||||
}
|
||||
while (n--) {
|
||||
lcd_write_data(pixel.v);
|
||||
|
@ -183,7 +189,10 @@ class IO {
|
|||
|
||||
void lcd_write_pixels_unrolled8(ui::Color pixel, size_t n) {
|
||||
if (get_dark_cover()) {
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
if (!get_is_inverted())
|
||||
pixel.v = DARKENED_PIXEL(pixel.v, get_brightness());
|
||||
else
|
||||
pixel.v = UNDARKENED_PIXEL(pixel.v, get_brightness());
|
||||
}
|
||||
auto v = pixel.v;
|
||||
n >>= 3;
|
||||
|
@ -231,7 +240,7 @@ class IO {
|
|||
|
||||
return switches_raw;
|
||||
}
|
||||
|
||||
bool get_is_inverted();
|
||||
bool get_dark_cover();
|
||||
uint8_t get_brightness();
|
||||
// TODO: cache the value ^^ & ^ to increaase performance, need a trigger cuz init doesn't work. And since the constructor is constexpr, we can't use with in class var to cache it. maybe cache from outside somewhere and pass it here as argument.
|
||||
|
@ -417,7 +426,10 @@ class IO {
|
|||
uint32_t original_value = (value_high << 8) | value_low;
|
||||
|
||||
if (get_dark_cover()) {
|
||||
original_value = UNDARKENED_PIXEL(original_value, get_brightness());
|
||||
if (!get_is_inverted())
|
||||
original_value = DARKENED_PIXEL(original_value, get_brightness());
|
||||
else
|
||||
original_value = UNDARKENED_PIXEL(original_value, get_brightness());
|
||||
}
|
||||
return original_value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue