Ticket #1999: patch_bootsplash_20080405.diff
File patch_bootsplash_20080405.diff, 7.2 KB (added by , 16 years ago) |
---|
-
src/tools/generate_boot_screen.cpp
12 12 #include <iostream> 13 13 #include <png.h> 14 14 #include <string> 15 #include <stdarg.h> 15 16 16 17 // TODO: Generate the single optimal palette for all three images, 17 18 // store palette versions of these images as well, so that they are … … 123 124 { 124 125 fprintf(sOutput, "static const uint16 %sWidth = %d;\n", baseName, width); 125 126 fprintf(sOutput, "static const uint16 %sHeight = %d;\n", baseName, height); 126 fprintf(sOutput, "static const uint8 %sImage[] = {\n\t", baseName); 127 fprintf(sOutput, "#ifndef __BOOTSPLASH_KERNEL__\n"); 128 fprintf(sOutput, "static const RLE_element %sCompressedImage[] = {\n\t", baseName); 127 129 128 130 int offset = 0; 131 int lastColor = -1; 132 int counter = 0; 129 133 for (int y = 0; y < height; y++) { 130 134 png_byte* row = rowPtrs[y]; 131 135 for (int x = 0; x < width * 3; x++) { 132 offset++; 133 if (x == width * 3 - 1 && y == height - 1) { 134 fprintf(sOutput, "0x%02x\n};\n\n", row[x]); 135 break; 136 } else if ((offset % 12) == 0) 137 fprintf(sOutput, "0x%02x,\n\t", row[x]); 138 else 139 fprintf(sOutput, "0x%02x, ", row[x]); 136 // if the currentColor is already being counted... 137 if (lastColor == row[x]) { 138 counter++; 139 } else { // otherwise display what we had in memory, record that color and reset the counter... 140 if (lastColor != -1) { 141 offset++; 142 fprintf(sOutput, "{%d, 0x%02x}, ", counter, lastColor); 143 if (offset % 6 == 0) { 144 fprintf(sOutput, "\n\t"); 145 } 146 } 147 lastColor = row[x]; 148 counter = 1; 149 } 150 151 if (x == width * 3 - 1 && y == height - 1) { // if we reach the end... 152 fprintf(sOutput, "{%d, 0x%02x}\n};\n\n", counter, row[x]); 153 offset++; 154 break; 155 } 140 156 } 141 157 } 158 fprintf(sOutput, "static const uint16 %sSize = %d;\n", baseName, offset); 159 fprintf(sOutput, "#endif\n\n"); 142 160 } 143 161 144 162 … … 210 228 fprintf(sOutput, "static const int32 kSplashIconsPlacementY = %d;\n\n", 211 229 iconPlacementY); 212 230 231 fprintf(sOutput, "struct RLE_element \n{\n\tuint16 count; \n\tuint8 colorComponent;\n};\n\n"); 232 213 233 parseImage(argv[1], "kSplashLogo"); 214 234 parseImage(argv[4], "kSplashIcons"); 215 235 -
src/system/kernel/boot_splash.cpp
7 7 */ 8 8 9 9 10 #include <boot_splash.h>11 12 10 #include <stdio.h> 13 11 #include <stdlib.h> 14 12 #include <string.h> … … 16 14 17 15 #include <KernelExport.h> 18 16 17 #define __BOOTSPLASH_KERNEL__ 19 18 #include <boot/images.h> 19 20 20 21 #include <boot_item.h> 21 22 #include <debug.h> 22 23 #include <frame_buffer_console.h> 23 24 25 #include <boot_splash.h> 24 26 27 25 28 //#define TRACE_BOOT_SPLASH 1 26 29 #ifdef TRACE_BOOT_SPLASH 27 30 # define TRACE(x...) dprintf(x); … … 31 34 32 35 33 36 static struct frame_buffer_boot_info *sInfo; 37 static uint8 *uncompressedIcons; 34 38 35 36 39 static void 37 40 blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop, 38 41 uint16 imageRight, uint16 imageBottom, uint16 imageWidth, … … 168 171 169 172 170 173 void 171 boot_splash_init( void)174 boot_splash_init(uint8 *boot_splash) 172 175 { 173 176 TRACE("boot_splash_init: enter\n"); 174 177 … … 177 180 178 181 sInfo = (frame_buffer_boot_info *)get_boot_item(FRAME_BUFFER_BOOT_INFO, 179 182 NULL); 183 184 uncompressedIcons = boot_splash; 180 185 } 181 186 182 187 … … 201 206 int stageRightEdge = width * (stage + 1) / BOOT_SPLASH_STAGE_MAX; 202 207 203 208 height = min_c(iconsHalfHeight, sInfo->height); 204 blit_cropped( kSplashIconsImage, NULL, stageLeftEdge, 0, stageRightEdge,209 blit_cropped(uncompressedIcons, NULL, stageLeftEdge, 0, stageRightEdge, 205 210 height, kSplashIconsWidth, NULL, x, y); 206 211 } 207 212 -
src/system/kernel/main.c
224 224 225 225 TRACE("start of main2: initializing devices\n"); 226 226 227 boot_splash_init( );227 boot_splash_init(sKernelArgs.boot_splash); 228 228 229 229 TRACE("Init modules\n"); 230 230 boot_splash_set_stage(BOOT_SPLASH_STAGE_1_INIT_MODULES); -
src/system/boot/platform/bios_ia32/video.cpp
794 794 } 795 795 } 796 796 797 798 static void 799 uncompressRLE(const RLE_element *compressed, uint8 *uncompressed, uint16 size) 800 { 801 uint32 cursor = 0; 802 for (uint16 i=0; i < size; i++) { 803 memset(uncompressed+cursor, compressed[i].colorComponent, compressed[i].count); 804 cursor += compressed[i].count; 805 } 806 } 807 797 808 // #pragma mark - 798 809 799 810 extern "C" void … … 868 879 memset((void *)sFrameBuffer, 0, 869 880 gKernelArgs.frame_buffer.physical_buffer.size); 870 881 882 uint8 * uncompressedLogo = (uint8*)kernel_args_malloc(kSplashLogoWidth*kSplashLogoHeight*3); 883 uncompressRLE(kSplashLogoCompressedImage, uncompressedLogo, kSplashLogoSize); 884 871 885 // TODO: support indexed versions of the images! 872 // TODO: support compressed RGB image data (simple RLE?)873 886 874 887 // render splash logo 875 888 uint16 iconsHalfHeight = kSplashIconsHeight / 2; … … 884 897 int y = (gKernelArgs.frame_buffer.height - height) * placementY / 100; 885 898 886 899 height = min_c(kSplashLogoHeight, gKernelArgs.frame_buffer.height); 887 blit_image( kSplashLogoImage, NULL, width, height, kSplashLogoWidth,900 blit_image(uncompressedLogo, NULL, width, height, kSplashLogoWidth, 888 901 NULL, x, y); 889 902 903 kernel_args_free(uncompressedLogo); 904 905 gKernelArgs.boot_splash = (uint8*)kernel_args_malloc(kSplashIconsWidth*kSplashIconsHeight*3); 906 uncompressRLE(kSplashIconsCompressedImage, gKernelArgs.boot_splash, kSplashIconsSize); 907 890 908 // render initial (grayed out) icons 891 909 // the grayed out version is the lower half of the icons image 892 910 … … 901 919 * placementY / 100; 902 920 903 921 // pointer into the lower half of the icons image data 904 const uint8* lowerHalfIconImage = kSplashIconsImage922 const uint8* lowerHalfIconImage = gKernelArgs.boot_splash 905 923 + (kSplashIconsWidth * iconsHalfHeight) * 3; 906 924 height = min_c(iconsHalfHeight, gKernelArgs.frame_buffer.height); 907 925 blit_image(lowerHalfIconImage, NULL, width, height, -
headers/private/kernel/boot/kernel_args.h
79 79 80 80 platform_kernel_args platform_args; 81 81 arch_kernel_args arch_args; 82 83 // bootsplash data 84 uint8 *boot_splash; 85 82 86 } kernel_args; 83 87 84 88 #endif /* KERNEL_BOOT_KERNEL_ARGS_H */ -
headers/private/kernel/boot_splash.h
11 11 12 12 #include <sys/types.h> 13 13 14 15 14 enum { 16 15 BOOT_SPLASH_STAGE_1_INIT_MODULES = 0, 17 16 BOOT_SPLASH_STAGE_2_BOOTSTRAP_FS, … … 29 28 extern "C" { 30 29 #endif 31 30 32 void boot_splash_init( void);31 void boot_splash_init(uint8 * boot_splash); 33 32 void boot_splash_set_stage(int stage); 34 33 35 34 #ifdef __cplusplus