1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

[Horus] Menus icons now in cache

I hope it will reduce calculation time a little bit!
This commit is contained in:
Bertrand Songis 2016-04-07 08:26:04 +02:00
parent b1e5e06d5b
commit eaed9dd1a9
86 changed files with 373 additions and 352 deletions

View file

@ -222,6 +222,35 @@ void BitmapBuffer::drawPie(int x0, int y0, int radius, int startAngle, int endAn
}
}
void BitmapBuffer::drawMask(coord_t x, coord_t y, BitmapBuffer * mask, LcdFlags flags, coord_t offset, coord_t width)
{
if (mask == NULL) {
return;
}
coord_t w = mask->getWidth();
coord_t height = mask->getHeight();
if (!width || width > w) {
width = w;
}
if (x+width > this->width) {
width = this->width-x;
}
display_t color = lcdColorTable[COLOR_IDX(flags)];
for (coord_t row=0; row<height; row++) {
display_t * p = getPixelPtr(x, y+row);
display_t * q = mask->getPixelPtr(offset, row);
for (coord_t col=0; col<width; col++) {
drawAlphaPixel(p, *((uint8_t *)q), color);
p++; q++;
}
}
}
void BitmapBuffer::drawBitmapPattern(coord_t x, coord_t y, const uint8_t * bmp, LcdFlags flags, coord_t offset, coord_t width)
{
coord_t w = *((uint16_t *)bmp);
@ -432,6 +461,19 @@ BitmapBuffer * BitmapBuffer::load(const char * filename)
return load_stb(filename);
}
BitmapBuffer * BitmapBuffer::loadMask(const char * filename)
{
BitmapBuffer * bitmap = BitmapBuffer::load(filename);
if (bitmap) {
display_t * p = bitmap->getData();
for (int i = bitmap->getWidth() * bitmap->getHeight(); i > 0; i--) {
*((uint8_t *)p) = OPACITY_MAX - ((*p) >> 12);
p++;
}
}
return bitmap;
}
FIL imgFile __DMA;
BitmapBuffer * BitmapBuffer::load_bmp(const char * filename)