[Horus] More bitmaps on SD. PNG format used instead of BMP. And yes it's a bad idea given the resources we have.

This commit is contained in:
Bertrand Songis
2016-02-29 22:17:47 +01:00
parent f65e42833e
commit 1fd1e141f2
34 changed files with 274 additions and 98 deletions
+26 -4
View File
@@ -659,7 +659,7 @@ void lcdDrawBlackOverlay()
}
#if defined(SIMU)
BitmapBuffer _lcd(LCD_W, LCD_H, displayBuf);
BitmapBuffer _lcd(BMP_RGB565, LCD_W, LCD_H, displayBuf);
BitmapBuffer * lcd = &_lcd;
void DMAFillRect(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color)
@@ -678,12 +678,12 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y, cons
}
}
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t h)
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h)
{
for (coord_t line=0; line<h; line++) {
uint16_t * p = dest + (y+line)*destw + x;
const uint16_t * q = src + line*srcw;
for (coord_t col=0; col<srcw; col++) {
const uint16_t * q = src + (srcy+line)*srcw + srcx;
for (coord_t col=0; col<w; col++) {
uint8_t alpha = *q >> 12;
uint8_t red = ((((*q >> 8) & 0x0f) << 1) * alpha + (*p >> 11) * (0x0f-alpha)) / 0x0f;
uint8_t green = ((((*q >> 4) & 0x0f) << 2) * alpha + ((*p >> 5) & 0x3f) * (0x0f-alpha)) / 0x0f;
@@ -693,4 +693,26 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t x, uint16_t y,
}
}
}
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format)
{
if (format == DMA2D_ARGB4444) {
for (int row = 0; row < h; ++row) {
for (int col = 0; col < w; ++col) {
*dest = ARGB(src[0], src[1], src[2], src[3]);
++dest;
src += 4;
}
}
}
else {
for (int row = 0; row < h; ++row) {
for(int col = 0; col < w; ++col) {
*dest = RGB(src[1], src[2], src[3]);
++dest;
src += 4;
}
}
}
}
#endif