Use compressed splash image

This commit is contained in:
Raphael Coeffic
2021-06-10 19:58:47 +02:00
parent fac069cd21
commit 2e77f23da4
3 changed files with 14 additions and 12 deletions
+12 -12
View File
@@ -22,20 +22,25 @@
#if defined(SPLASH)
const uint8_t __bmp_splash[] __ALIGNED(4) {
#include "bmp_splash.lbm"
const uint8_t __bmp_splash[] {
#include "splash.lbm"
};
Bitmap BMP_SPLASH(BMP_RGB565, (const uint16_t *)__bmp_splash);
void drawSplash()
{
static bool loadImgFromSD = true;
static bool loadSplashImg = true;
static BitmapBuffer * splashImg = nullptr;
if (loadImgFromSD && splashImg == nullptr) {
// try splash from SD card first
if (loadSplashImg && splashImg == nullptr) {
if (!sdMounted()) sdInit();
splashImg = BitmapBuffer::loadBitmap(BITMAPS_PATH "/" SPLASH_FILE);
loadImgFromSD = false;
loadSplashImg = false;
// otherwise load from FLASH
if (splashImg == nullptr) {
splashImg = BitmapBuffer::loadRamBitmap(__bmp_splash, sizeof(__bmp_splash));
}
}
lcd->clear();
@@ -45,12 +50,7 @@ void drawSplash()
(LCD_H - splashImg->height())/2,
splashImg);
}
else {
lcd->drawBitmap((LCD_W - BMP_SPLASH.width())/2,
(LCD_H - BMP_SPLASH.height())/2,
&BMP_SPLASH);
}
lcdRefresh();
}
#endif