chore(bw): Reduce FLASH used by 212x64 startup/shutdown animations (#3989)

* Reduce FLASH storage of startup/shutdown animation for 212x64 LCD B&W radios.

* Simplify bitmaps.

* Support drawing animation bitmaps with transparency.
This commit is contained in:
philmoz
2023-09-04 14:10:50 +10:00
committed by GitHub
parent 8be8b51813
commit 9f4997caea
6 changed files with 63 additions and 18 deletions
+32 -11
View File
@@ -1008,7 +1008,7 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset, co
}
}
void lcdDrawRleBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t width)
void lcdDrawRleBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset, coord_t width, bool overlay)
{
RleBitmap pic(img, offset);
@@ -1024,19 +1024,40 @@ void lcdDrawRleBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset,
for (uint8_t row=0; row<rows; row++) {
uint8_t *p = &displayBuf[(row + (y/2)) * LCD_W + x];
for (coord_t i=0; i<width; i++) {
if (p >= DISPLAY_END) return;
uint8_t b = pic.getNext();
if (y & 1) {
*p = (*p & 0x0f) + ((b & 0x0f) << 4);
if ((p+LCD_W) < DISPLAY_END) {
*(p+LCD_W) = (*(p+LCD_W) & 0xf0) + ((b & 0xf0) >> 4);
if (overlay) {
for (coord_t i=0; i<width; i++) {
if (p >= DISPLAY_END) return;
uint8_t b = pic.getNext();
if (y & 1) {
if (b & 0x0f)
*p = (*p & 0x0f) + ((b & 0x0f) << 4);
if ((p+LCD_W) < DISPLAY_END && b & 0xf0) {
*(p+LCD_W) = (*(p+LCD_W) & 0xf0) + ((b & 0xf0) >> 4);
}
}
else {
if (b & 0x0f)
*p = (*p & 0xf0) + (b & 0x0f);
if (b & 0xf0)
*p = (*p & 0x0f) + (b & 0xf0);
}
p++;
}
else {
*p = b;
} else {
for (coord_t i=0; i<width; i++) {
if (p >= DISPLAY_END) return;
uint8_t b = pic.getNext();
if (y & 1) {
*p = (*p & 0x0f) + ((b & 0x0f) << 4);
if ((p+LCD_W) < DISPLAY_END) {
*(p+LCD_W) = (*(p+LCD_W) & 0xf0) + ((b & 0xf0) >> 4);
}
}
else {
*p = b;
}
p++;
}
p++;
}
pic.goToNextRow();
pic.skip(offset);