From a5f2bb9d579ae575bff106f68cd4504c74f107cd Mon Sep 17 00:00:00 2001 From: Kostas Missos Date: Mon, 9 Jul 2018 15:55:09 +0300 Subject: [PATCH] Support custom backcolor when logo is smaller When the bootlogo is smaller than 720x1280, the background color will be set to match the color of bmp's 1st pixel. This ends the limit of having to use a background color of 0x1B1B1B. --- README_BOOTLOGO.md | 8 +++++--- ipl/main.c | 5 ++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README_BOOTLOGO.md b/README_BOOTLOGO.md index 57636ee..2c60510 100644 --- a/README_BOOTLOGO.md +++ b/README_BOOTLOGO.md @@ -1,10 +1,12 @@ # hekate - Bootlogo -The bootlogo can be any size with a maximum of 720 x 1280. It is automatically centered when it's smaller than 720 x 1280. +The bootlogo can be any size with a maximum of 720 x 1280. -When saving a landscape bootlogo, it should be rotated 90o counterclockwise. +When it's smaller than 720 x 1280, it is automatically centered and the background takes the color of the first pixel. -Lastly, the supported format is 32-bit BMP. Classic 24-bit BMPs are not supported for performance reasons. +When saving a landscape bootlogo, it should be rotated 90 degrees counterclockwise. + +Lastly, the supported format is 32-bit (ARGB) BMP. Classic 24-bit (RGB) BMPs are not supported for performance reasons. ## How to configure diff --git a/ipl/main.c b/ipl/main.c index ae7ea85..e95e9ac 100755 --- a/ipl/main.c +++ b/ipl/main.c @@ -1816,6 +1816,9 @@ void auto_launch_firmware() // Center logo if res < 720x1280. bmpData.pos_x = (720 - bmpData.size_x) >> 1; bmpData.pos_y = (1280 - bmpData.size_y) >> 1; + // Get background color from 1st pixel. + if (bmpData.size_x < 720 || bmpData.size_y < 1280) + gfx_clear_color(&gfx_ctxt, *(u32 *)BOOTLOGO); bootlogoFound = 1; } @@ -1865,6 +1868,7 @@ void auto_launch_firmware() } out:; + gfx_clear_grey(&gfx_ctxt, 0x1B); if (!ini_freed) ini_free(&ini_sections); ini_free_section(cfg_sec); @@ -2502,7 +2506,6 @@ void ipl_main() //display_color_screen(0xAABBCCDD); u32 *fb = display_init_framebuffer(); gfx_init_ctxt(&gfx_ctxt, fb, 720, 1280, 768); - gfx_clear_grey(&gfx_ctxt, 0x1B); #ifdef MENU_LOGO_ENABLE Kc_MENU_LOGO = (u8 *)malloc(0x6000);