RLE for greyscale lcd (gives more firmware space!) (#1142)
* use RLE encodes bitmaps on 212x64 pixel radios * fix model image display fix icon display * implement RLE bitmaps in companion for splash image on 212x64 radios reserve 3kB for RLE bitmaps in firmware * fix size check * use defines instead of magic numbers * fix display of splash screens on 212x64 radios * add warning message if compressed image is larger than the reserved space
This commit is contained in:
@@ -976,4 +976,39 @@ 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)
|
||||
{
|
||||
RleBitmap pic(img, offset);
|
||||
|
||||
uint8_t w = pic.getWidth();
|
||||
if (!width || width > w) {
|
||||
width = w;
|
||||
}
|
||||
if (x+width > LCD_W) {
|
||||
if (x >= LCD_W ) return;
|
||||
width = LCD_W-x;
|
||||
}
|
||||
uint8_t rows = pic.getRows();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
else {
|
||||
*p = b;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
pic.goToNextRow();
|
||||
pic.skip(offset);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user