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
+2
View File
@@ -20,6 +20,8 @@ set(BITMAP_RLE_ARGS ${BITMAP_ARGS} --rle)
set(MASK_RLE_ARGS ${MASK_ARGS} --rle)
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/bmp_*.png" "5/6/5" "${BITMAP_ARGS}")
add_png_target(${BITMAP_TARGET_PREFIX}_splash "${RADIO_SRC_DIR}/bitmaps/480x272/splash.png")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_calibration_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/calibration/bmp_*.png" "5/6/5" "${BITMAP_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_button_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/button/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}")
add_bitmaps_target(${BITMAP_TARGET_PREFIX}_alpha_bitmaps "${RADIO_SRC_DIR}/bitmaps/480x272/alpha_*.png" "4/4/4/4" "${BITMAP_ARGS}")

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

+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