* Removed the Copyright image/rendering.

* Fixed the icons image, it was upside down.
* Support the new 24 bit boot screen images in the boot_loader and the kernel.
* Prepare the code for future indexed versions of the boot screen images.
  But the generate_boot_screen tool currently does not generate those.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24449 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-03-18 20:27:47 +00:00
parent d37b47817b
commit 55ef60a5ae
8 changed files with 21570 additions and 8028 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

File diff suppressed because it is too large Load Diff

View File

@ -547,20 +547,21 @@ set_text_mode(void)
static void
blit32(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
blit32(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
{
uint32 *start = (uint32 *)(sFrameBuffer
+ gKernelArgs.frame_buffer.bytes_per_row * top + 4 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint32* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = (palette[color + 0] << 16) | (palette[color + 1] << 8)
| (palette[color + 2]);
dst[0] = (src[0] << 16) | (src[1] << 8) | (src[2]);
dst++;
src += 3;
}
data += width * 3;
start = (uint32 *)((addr_t)start
+ gKernelArgs.frame_buffer.bytes_per_row);
}
@ -568,43 +569,46 @@ blit32(const uint8 *data, uint16 width, uint16 height,
static void
blit24(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
blit24(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
{
uint8 *start = (uint8 *)sFrameBuffer
+ gKernelArgs.frame_buffer.bytes_per_row * top + 3 * left;
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint8* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
uint32 index = x * 3;
start[index + 0] = palette[color + 2];
start[index + 1] = palette[color + 1];
start[index + 2] = palette[color + 0];
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst += 3;
src += 3;
}
data += width * 3;
start = start + gKernelArgs.frame_buffer.bytes_per_row;
}
}
static void
blit16(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
blit16(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
{
uint16 *start = (uint16 *)(sFrameBuffer
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = ((palette[color + 0] >> 3) << 11)
| ((palette[color + 1] >> 2) << 5)
| ((palette[color + 2] >> 3));
dst[0] = ((src[2] >> 3) << 11)
| ((src[1] >> 2) << 5)
| ((src[0] >> 3));
dst++;
src += 3;
}
data += width * 3;
start = (uint16 *)((addr_t)start
+ gKernelArgs.frame_buffer.bytes_per_row);
}
@ -612,21 +616,23 @@ blit16(const uint8 *data, uint16 width, uint16 height,
static void
blit15(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
blit15(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
{
uint16 *start = (uint16 *)(sFrameBuffer
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = ((palette[color + 0] >> 3) << 10)
| ((palette[color + 1] >> 3) << 5)
| ((palette[color + 2] >> 3));
dst[0] = ((src[2] >> 3) << 10)
| ((src[1] >> 3) << 5)
| ((src[0] >> 3));
dst++;
src += 3;
}
data += width * 3;
start = (uint16 *)((addr_t)start
+ gKernelArgs.frame_buffer.bytes_per_row);
}
@ -637,6 +643,9 @@ static void
blit8(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
{
if (!data || !palette)
return;
if (vesa_set_palette((const uint8 *)palette, 0, 256) != B_OK)
dprintf("set palette failed!\n");
@ -654,6 +663,8 @@ static void
blit4(const uint8 *data, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
{
if (!data || !palette)
return;
// vga_set_palette((const uint8 *)kPalette16, 0, 16);
// ToDo: no boot logo yet in VGA mode
#if 1
@ -700,22 +711,22 @@ blit4(const uint8 *data, uint16 width, uint16 height,
static void
blit_8bit_image(const uint8 *data, uint16 width, uint16 height,
blit_image(const uint8 *data, const uint8* indexedData, uint16 width, uint16 height,
const uint8 *palette, uint16 left, uint16 top)
{
switch (gKernelArgs.frame_buffer.depth) {
case 4:
return blit4(data, width, height, palette, left, top);
return blit4(indexedData, width, height, palette, left, top);
case 8:
return blit8(data, width, height, palette, left, top);
return blit8(indexedData, width, height, palette, left, top);
case 15:
return blit15(data, width, height, palette, left, top);
return blit15(data, width, height, left, top);
case 16:
return blit16(data, width, height, palette, left, top);
return blit16(data, width, height, left, top);
case 24:
return blit24(data, width, height, palette, left, top);
return blit24(data, width, height, left, top);
case 32:
return blit32(data, width, height, palette, left, top);
return blit32(data, width, height, left, top);
}
}
@ -786,22 +797,26 @@ fallback:
}
// clear the video memory
memset((void *)sFrameBuffer, 255,
memset((void *)sFrameBuffer, 0,
gKernelArgs.frame_buffer.physical_buffer.size);
int x = gKernelArgs.frame_buffer.width / 2 - splashWidth / 2;
int y = gKernelArgs.frame_buffer.height / 2 - splashHeight / 2;
blit_8bit_image(splashImage, splashWidth, splashHeight, splashPalette, x, y);
// TODO: support indexed versions of the images!
// TODO: support compressed RGB image data
x = gKernelArgs.frame_buffer.width / 2 - iconsWidth / 2;
y = y + splashHeight;
uint16 iconsHalfHeight = iconsHeight / 2;
const uint8* lowerHalfIconImage = iconsImage + iconsWidth * iconsHalfHeight;
blit_8bit_image(lowerHalfIconImage, iconsWidth, iconsHalfHeight, iconsPalette, x, y);
// render splash logo
int x = gKernelArgs.frame_buffer.width / 2 - kSplashLogoWidth / 2;
int y = gKernelArgs.frame_buffer.height / 2 - kSplashLogoHeight / 2;
blit_image(kSplashLogoImage, NULL, kSplashLogoWidth, kSplashLogoHeight,
NULL, x, y);
x = gKernelArgs.frame_buffer.width / 2 - copyrightWidth / 2;
y = gKernelArgs.frame_buffer.height - copyrightHeight - 5;
blit_8bit_image(copyrightImage, copyrightWidth, copyrightHeight, copyrightPalette, x, y);
// render initial (grayed out) icons
x = gKernelArgs.frame_buffer.width / 2 - kSplashIconsWidth / 2;
y = y + kSplashLogoHeight;
uint16 iconsHalfHeight = kSplashIconsHeight / 2;
const uint8* lowerHalfIconImage = kSplashIconsImage
+ (kSplashIconsWidth * iconsHalfHeight) * 3;
blit_image(lowerHalfIconImage, NULL, kSplashIconsWidth, iconsHalfHeight,
NULL, x, y);
}

View File

@ -35,7 +35,7 @@ struct boot_splash_info {
static struct boot_splash_info sBootSplash;
/*
static void
boot_splash_fb_vga_set_palette(const uint8 *palette, int32 firstIndex,
int32 numEntries)
@ -55,6 +55,8 @@ static void
boot_splash_fb_blit4(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
{
if (!data || !palette)
return;
// ToDo: no blit yet in VGA mode
}
@ -63,6 +65,9 @@ static void
boot_splash_fb_blit8(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
{
if (!data || !palette)
return;
boot_splash_fb_vga_set_palette(palette, 0, 256);
addr_t start = sBootSplash.frame_buffer + sBootSplash.bytes_per_row * top
@ -76,117 +81,154 @@ boot_splash_fb_blit8(const uint8 *data, uint16 width,
static void
boot_splash_fb_blit15(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
boot_splash_fb_blit15(const uint8 *data, uint16 width, uint16 height,
uint16 left, uint16 top)
{
uint16 *start = (uint16 *)(sBootSplash.frame_buffer
uint16* start = (uint16*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 2 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = ((palette[color + 0] >> 3) << 10)
| ((palette[color + 1] >> 3) << 5)
| ((palette[color + 2] >> 3));
dst[0] = ((src[2] >> 3) << 10)
| ((src[1] >> 3) << 5)
| ((src[0] >> 3));
dst++;
src += 3;
}
start = (uint16 *)((addr_t)start
+ sBootSplash.bytes_per_row);
data += width * 3;
start = (uint16*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
static void
boot_splash_fb_blit16(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
boot_splash_fb_blit16(const uint8 *data, uint16 width, uint16 height,
uint16 left, uint16 top)
{
uint16 *start = (uint16 *)(sBootSplash.frame_buffer
uint16* start = (uint16*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 2 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = ((palette[color + 0] >> 3) << 11)
| ((palette[color + 1] >> 2) << 5)
| ((palette[color + 2] >> 3));
dst[0] = ((src[2] >> 3) << 11)
| ((src[1] >> 2) << 5)
| ((src[0] >> 3));
dst++;
src += 3;
}
start = (uint16 *)((addr_t)start
+ sBootSplash.bytes_per_row);
data += width * 3;
start = (uint16*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
static void
boot_splash_fb_blit24(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
boot_splash_fb_blit24(const uint8 *data, uint16 width, uint16 height,
uint16 left, uint16 top)
{
uint8 *start = (uint8 *)sBootSplash.frame_buffer
uint8* start = (uint8*)sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 3 * left;
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint8* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
uint32 index = x * 3;
start[index + 0] = palette[color + 2];
start[index + 1] = palette[color + 1];
start[index + 2] = palette[color + 0];
dst[0] = src[2];
dst[1] = src[1];
dst[2] = src[0];
dst += 3;
src += 3;
}
data += width * 3;
start = start + sBootSplash.bytes_per_row;
}
}
static void
boot_splash_fb_blit32(const uint8 *data, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
boot_splash_fb_blit32(const uint8 *data, uint16 width, uint16 height,
uint16 left, uint16 top)
{
uint32 *start = (uint32 *)(sBootSplash.frame_buffer
uint32* start = (uint32*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 4 * left);
for (int32 y = 0; y < height; y++) {
const uint8* src = data;
uint32* dst = start;
for (int32 x = 0; x < width; x++) {
uint16 color = data[y * width + x] * 3;
start[x] = (palette[color + 0] << 16) | (palette[color + 1] << 8)
| (palette[color + 2]);
dst[0] = (src[2] << 16) | (src[1] << 8) | (src[0]);
dst++;
src += 3;
}
start = (uint32 *)((addr_t)start
+ sBootSplash.bytes_per_row);
data += width * 3;
start = (uint32*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
static void
boot_splash_fb_blit(const uint8 *data, uint16 width,
boot_splash_fb_blit(const uint8 *data, const uint8* indexedData, uint16 width,
uint16 height, const uint8 *palette, uint16 left, uint16 top)
{
switch (sBootSplash.depth) {
case 4:
boot_splash_fb_blit4(data, width, height, palette, left, top);
boot_splash_fb_blit4(indexedData, width, height, palette,
left, top);
return;
case 8:
boot_splash_fb_blit8(data, width, height, palette, left, top);
boot_splash_fb_blit8(indexedData, width, height, palette,
left, top);
return;
case 15:
boot_splash_fb_blit15(data, width, height, palette, left, top);
boot_splash_fb_blit15(data, width, height, left, top);
return;
case 16:
boot_splash_fb_blit16(data, width, height, palette, left, top);
boot_splash_fb_blit16(data, width, height, left, top);
return;
case 24:
boot_splash_fb_blit24(data, width, height, palette, left, top);
boot_splash_fb_blit24(data, width, height, left, top);
return;
case 32:
boot_splash_fb_blit32(data, width, height, palette, left, top);
boot_splash_fb_blit32(data, width, height, left, top);
return;
}
}
*/
static void
boot_splash_fb_blit15_cropped(const uint8 *data, uint16 imageLeft,
uint16 imageTop, uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
{
data += (imageWidth * imageTop + imageLeft) * 3;
uint16* start = (uint16*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * (top + imageTop)
+ 2 * (left + imageLeft));
for (int32 y = imageTop; y < imageBottom; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = imageLeft; x < imageRight; x++) {
dst[0] = ((src[2] >> 3) << 10)
| ((src[1] >> 3) << 5)
| ((src[0] >> 3));
dst++;
src += 3;
}
data += imageWidth * 3;
start = (uint16*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
static void
@ -194,23 +236,52 @@ boot_splash_fb_blit16_cropped(const uint8 *data, uint16 imageLeft,
uint16 imageTop, uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
{
int32 dataOffset = (imageWidth * imageTop) + imageLeft;
uint16 *start = (uint16 *)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 2 * left);
data += (imageWidth * imageTop + imageLeft) * 3;
uint16* start = (uint16*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * (top + imageTop)
+ 2 * (left + imageLeft));
for (int32 y = imageTop; y < imageBottom; y++) {
const uint8* src = data;
uint16* dst = start;
for (int32 x = imageLeft; x < imageRight; x++) {
uint16 color = data[(y * (imageWidth)) + x] * 3;
dst[0] = ((src[2] >> 3) << 11)
| ((src[1] >> 2) << 5)
| ((src[0] >> 3));
start[x] = ((palette[color + 0] >> 3) << 11)
| ((palette[color + 1] >> 2) << 5)
| ((palette[color + 2] >> 3));
dataOffset += imageWidth;
dst++;
src += 3;
}
data += imageWidth * 3;
start = (uint16*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
start = (uint16 *)((addr_t)start + sBootSplash.bytes_per_row);
static void
boot_splash_fb_blit24_cropped(const uint8 *data, uint16 imageLeft,
uint16 imageTop, uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
{
data += (imageWidth * imageTop + imageLeft) * 3;
uint8* start = (uint8*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * (top + imageTop)
+ 3 * (left + imageLeft));
for (int32 y = imageTop; y < imageBottom; y++) {
const uint8* src = data;
uint8* dst = start;
for (int32 x = imageLeft; x < imageRight; x++) {
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst += 3;
src += 3;
}
data += imageWidth * 3;
start = (uint8*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
@ -220,48 +291,56 @@ boot_splash_fb_blit32_cropped(const uint8 *data, uint16 imageLeft,
uint16 imageTop, uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
{
int32 dataOffset = (imageWidth * imageTop) + imageLeft;
uint32 *start = (uint32 *)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * top + 4 * left);
data += (imageWidth * imageTop + imageLeft) * 3;
uint32* start = (uint32*)(sBootSplash.frame_buffer
+ sBootSplash.bytes_per_row * (top + imageTop)
+ 4 * (left + imageLeft));
for (int32 y = imageTop; y < imageBottom; y++) {
const uint8* src = data;
uint32* dst = start;
for (int32 x = imageLeft; x < imageRight; x++) {
uint16 color = data[(y * (imageWidth)) + x] * 3;
start[x] = (palette[color + 0] << 16) | (palette[color + 1] << 8)
| (palette[color + 2]);
dataOffset += imageWidth;
dst[0] = (src[0] << 16) | (src[1] << 8) | (src[2]);
dst++;
src += 3;
}
start = (uint32 *)((addr_t)start + sBootSplash.bytes_per_row);
data += imageWidth * 3;
start = (uint32*)((addr_t)start + sBootSplash.bytes_per_row);
}
}
static void
boot_splash_fb_blit_cropped(const uint8 *data, uint16 imageLeft,
uint16 imageTop, uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
boot_splash_fb_blit_cropped(const uint8* data, const uint8* indexedData,
uint16 imageLeft, uint16 imageTop, uint16 imageRight, uint16 imageBottom,
uint16 imageWidth, uint16 imageHeight, const uint8 *palette,
uint16 left, uint16 top)
{
switch (sBootSplash.depth) {
case 4:
case 8:
return;
case 15:
boot_splash_fb_blit15_cropped(data, imageLeft, imageTop,
imageRight, imageBottom, imageWidth, imageHeight, palette,
left, top);
return;
case 16:
boot_splash_fb_blit16_cropped(data, imageLeft, imageTop,
imageRight, imageBottom, imageWidth, imageHeight, palette,
left, top);
return;
case 24:
boot_splash_fb_blit24_cropped(data, imageLeft, imageTop,
imageRight, imageBottom, imageWidth, imageHeight, palette,
left, top);
return;
case 32:
boot_splash_fb_blit32_cropped(data, imageLeft, imageTop,
imageRight, imageBottom, imageWidth, imageHeight, palette,
left, top);
return;
case 24:
return;
}
}
@ -304,7 +383,7 @@ boot_splash_fb_init(struct kernel_args *args)
{
TRACE("boot_splash_fb_init: enter\n");
if (!args->frame_buffer.enabled) {
if (!args->frame_buffer.enabled/* || sDebugScreenEnabled*/) {
sBootSplash.enabled = false;
return B_OK;
}
@ -339,13 +418,15 @@ boot_splash_set_stage(int stage)
return;
// TODO: Use placement info from images.h
int x = sBootSplash.width / 2 - iconsWidth / 2;
int y = sBootSplash.height / 2 - splashHeight / 2;
y = y + splashHeight;
int x = sBootSplash.width / 2 - kSplashIconsWidth / 2;
int y = sBootSplash.height / 2 - kSplashLogoHeight / 2;
y = y + kSplashLogoHeight;
int stageLeftEdge = iconsWidth * stage / BOOT_SPLASH_STAGE_MAX;
int stageRightEdge = iconsWidth * (stage + 1) / BOOT_SPLASH_STAGE_MAX;
boot_splash_fb_blit_cropped(iconsImage, stageLeftEdge, 0,
stageRightEdge, 32, iconsWidth, iconsHeight, iconsPalette, x, y );
int stageLeftEdge = kSplashIconsWidth * stage / BOOT_SPLASH_STAGE_MAX;
int stageRightEdge = kSplashIconsWidth * (stage + 1)
/ BOOT_SPLASH_STAGE_MAX;
boot_splash_fb_blit_cropped(kSplashIconsImage, NULL, stageLeftEdge, 0,
stageRightEdge, kSplashIconsHeight / 2,
kSplashIconsWidth, kSplashIconsHeight, NULL, x, y );
}

View File

@ -164,14 +164,14 @@ parseImage(const char* filename, const char* baseName)
int
main(int argc, char* argv[])
{
if (argc < 5) {
if (argc < 4) {
printf("Usage:\n");
printf("\t%s <splash.png> <icons.png> <copyright.png> <images.h>\n",
printf("\t%s <splash.png> <icons.png> <images.h>\n",
argv[0]);
return 0;
}
const char* headerFileName = argv[4];
const char* headerFileName = argv[3];
sOutput = fopen(headerFileName, "wb");
if (!sOutput)
@ -182,7 +182,6 @@ main(int argc, char* argv[])
parseImage(argv[1], "kSplashLogo");
parseImage(argv[2], "kSplashIcons");
parseImage(argv[3], "kSplashCopyright");
fclose(sOutput);
return 0;