Skip to content

Commit

Permalink
BW invert (#21955)
Browse files Browse the repository at this point in the history
* bw invert option

* invert bw
  • Loading branch information
gemu2015 committed Aug 14, 2024
1 parent 102428f commit d525200
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/lib_display/Display_Renderer-gemu-1.0/src/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct LVGL_PARAMS {
uint8_t swap_color : 1;
uint8_t async_dma : 1; // force DMA completion before returning, avoid conflict with other devices on same bus. If set you should make sure the display is the only device on the bus
uint8_t busy_invert : 1;
uint8_t resvd_2 : 1;
uint8_t invert_bw : 1;
uint8_t resvd_3 : 1;
uint8_t resvd_4 : 1;
uint8_t resvd_5 : 1;
Expand Down
22 changes: 16 additions & 6 deletions lib/lib_display/UDisplay/uDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2197,12 +2197,22 @@ void uDisplay::pushColorsMono(uint16_t *data, uint16_t len, bool rgb16_swap) {

for (uint32_t y = seta_yp1; y < seta_yp2; y++) {
seta_yp1++;
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 1 : 0;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
if (lvgl_param.invert_bw) {
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 0 : 1;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
}
} else {
for (uint32_t x = seta_xp1; x < seta_xp2; x++) {
uint16_t color = *data++;
if (bpp == 1) color = (color & rgb16_to_mono_mask) ? 1 : 0;
drawPixel(x, y, color); // todo - inline the method to save speed
len--;
if (!len) return; // failsafe - exist if len (pixel number) is exhausted
}
}
}
}
Expand Down

0 comments on commit d525200

Please sign in to comment.