* Revised boot splash artwork, the logo is back in the lower right corner,
the icons are centered. * The boot loader and kernel now use the placement info that generate_boot_screen now generates. * Made the code that draws the images handle the case where any of the images is larger than the frame buffer. * All drawing functions need to know the image width (analogous for bytes per row). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24773 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
+11621
-21340
File diff suppressed because it is too large
Load Diff
@@ -604,7 +604,8 @@ set_text_mode(void)
|
||||
|
||||
|
||||
static void
|
||||
blit32(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
blit32(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
uint16 left, uint16 top)
|
||||
{
|
||||
uint32 *start = (uint32 *)(sFrameBuffer
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 4 * left);
|
||||
@@ -618,7 +619,7 @@ blit32(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
src += 3;
|
||||
}
|
||||
|
||||
data += width * 3;
|
||||
data += imageWidth * 3;
|
||||
start = (uint32 *)((addr_t)start
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||
}
|
||||
@@ -626,7 +627,8 @@ blit32(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
|
||||
|
||||
static void
|
||||
blit24(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
blit24(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
uint16 left, uint16 top)
|
||||
{
|
||||
uint8 *start = (uint8 *)sFrameBuffer
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 3 * left;
|
||||
@@ -642,14 +644,15 @@ blit24(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
src += 3;
|
||||
}
|
||||
|
||||
data += width * 3;
|
||||
data += imageWidth * 3;
|
||||
start = start + gKernelArgs.frame_buffer.bytes_per_row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
blit16(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
blit16(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
uint16 left, uint16 top)
|
||||
{
|
||||
uint16 *start = (uint16 *)(sFrameBuffer
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
|
||||
@@ -665,7 +668,7 @@ blit16(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
src += 3;
|
||||
}
|
||||
|
||||
data += width * 3;
|
||||
data += imageWidth * 3;
|
||||
start = (uint16 *)((addr_t)start
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||
}
|
||||
@@ -673,7 +676,8 @@ blit16(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
|
||||
|
||||
static void
|
||||
blit15(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
blit15(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
uint16 left, uint16 top)
|
||||
{
|
||||
uint16 *start = (uint16 *)(sFrameBuffer
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
|
||||
@@ -689,7 +693,7 @@ blit15(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
src += 3;
|
||||
}
|
||||
|
||||
data += width * 3;
|
||||
data += imageWidth * 3;
|
||||
start = (uint16 *)((addr_t)start
|
||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||
}
|
||||
@@ -697,7 +701,7 @@ blit15(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
||||
|
||||
|
||||
static void
|
||||
blit8(const uint8 *data, uint16 width, uint16 height,
|
||||
blit8(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
if (!data || !palette)
|
||||
@@ -711,13 +715,13 @@ blit8(const uint8 *data, uint16 width, uint16 height,
|
||||
|
||||
for (int32 i = 0; i < height; i++) {
|
||||
memcpy((void *)(start + gKernelArgs.frame_buffer.bytes_per_row * i),
|
||||
&data[i * width], width);
|
||||
&data[i * imageWidth], width);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
blit4(const uint8 *data, uint16 width, uint16 height,
|
||||
blit4(const uint8 *data, uint16 width, uint16 height, uint16 imageWidth,
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
if (!data || !palette)
|
||||
@@ -768,22 +772,25 @@ blit4(const uint8 *data, uint16 width, uint16 height,
|
||||
|
||||
|
||||
static void
|
||||
blit_image(const uint8 *data, const uint8* indexedData, uint16 width, uint16 height,
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
blit_image(const uint8 *data, const uint8* indexedData, uint16 width,
|
||||
uint16 height, uint16 imageWidth, const uint8 *palette, uint16 left,
|
||||
uint16 top)
|
||||
{
|
||||
switch (gKernelArgs.frame_buffer.depth) {
|
||||
case 4:
|
||||
return blit4(indexedData, width, height, palette, left, top);
|
||||
return blit4(indexedData, width, height, imageWidth, palette,
|
||||
left, top);
|
||||
case 8:
|
||||
return blit8(indexedData, width, height, palette, left, top);
|
||||
return blit8(indexedData, width, height, imageWidth, palette,
|
||||
left, top);
|
||||
case 15:
|
||||
return blit15(data, width, height, left, top);
|
||||
return blit15(data, width, height, imageWidth, left, top);
|
||||
case 16:
|
||||
return blit16(data, width, height, left, top);
|
||||
return blit16(data, width, height, imageWidth, left, top);
|
||||
case 24:
|
||||
return blit24(data, width, height, left, top);
|
||||
return blit24(data, width, height, imageWidth, left, top);
|
||||
case 32:
|
||||
return blit32(data, width, height, left, top);
|
||||
return blit32(data, width, height, imageWidth, left, top);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -858,21 +865,36 @@ fallback:
|
||||
gKernelArgs.frame_buffer.physical_buffer.size);
|
||||
|
||||
// TODO: support indexed versions of the images!
|
||||
// TODO: support compressed RGB image data
|
||||
// TODO: support compressed RGB image data (simple RLE?)
|
||||
|
||||
// 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,
|
||||
int width = min_c(kSplashLogoWidth, gKernelArgs.frame_buffer.width);
|
||||
int height = min_c(kSplashLogoHeight, gKernelArgs.frame_buffer.height);
|
||||
int placementX = max_c(0, min_c(100, kSplashLogoPlacementX));
|
||||
int placementY = max_c(0, min_c(100, kSplashLogoPlacementY));
|
||||
|
||||
int x = (gKernelArgs.frame_buffer.width - width) * placementX / 100;
|
||||
int y = (gKernelArgs.frame_buffer.height - height) * placementY / 100;
|
||||
|
||||
blit_image(kSplashLogoImage, NULL, width, height, kSplashLogoWidth,
|
||||
NULL, x, y);
|
||||
|
||||
// render initial (grayed out) icons
|
||||
x = gKernelArgs.frame_buffer.width / 2 - kSplashIconsWidth / 2;
|
||||
y = y + kSplashLogoHeight;
|
||||
// the grayed out version is the lower half of the icons image
|
||||
uint16 iconsHalfHeight = kSplashIconsHeight / 2;
|
||||
|
||||
width = min_c(kSplashIconsWidth, gKernelArgs.frame_buffer.width);
|
||||
height = min_c(iconsHalfHeight, gKernelArgs.frame_buffer.height);
|
||||
placementX = max_c(0, min_c(100, kSplashIconsPlacementX));
|
||||
placementY = max_c(0, min_c(100, kSplashIconsPlacementY));
|
||||
|
||||
x = (gKernelArgs.frame_buffer.width - width) * placementX / 100;
|
||||
y = (gKernelArgs.frame_buffer.height - height) * placementY / 100;
|
||||
|
||||
// pointer into the lower half of the icons image data
|
||||
const uint8* lowerHalfIconImage = kSplashIconsImage
|
||||
+ (kSplashIconsWidth * iconsHalfHeight) * 3;
|
||||
blit_image(lowerHalfIconImage, NULL, kSplashIconsWidth, iconsHalfHeight,
|
||||
blit_image(lowerHalfIconImage, NULL, width, height, kSplashIconsWidth,
|
||||
NULL, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ static struct frame_buffer_boot_info *sInfo;
|
||||
static void
|
||||
blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
||||
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||
uint16* start = (uint16*)(sInfo->frame_buffer
|
||||
@@ -64,7 +64,7 @@ blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
static void
|
||||
blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
||||
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||
uint16* start = (uint16*)(sInfo->frame_buffer
|
||||
@@ -91,7 +91,7 @@ blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
static void
|
||||
blit24_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
||||
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||
uint8* start = (uint8*)(sInfo->frame_buffer
|
||||
@@ -117,7 +117,7 @@ blit24_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
static void
|
||||
blit32_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
||||
uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
|
||||
const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||
uint32* start = (uint32*)(sInfo->frame_buffer
|
||||
@@ -141,25 +141,24 @@ blit32_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||
static void
|
||||
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)
|
||||
uint16 imageWidth, const uint8 *palette, uint16 left, uint16 top)
|
||||
{
|
||||
switch (sInfo->depth) {
|
||||
case 15:
|
||||
blit15_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||
imageWidth, imageHeight, palette, left, top);
|
||||
imageWidth, palette, left, top);
|
||||
return;
|
||||
case 16:
|
||||
blit16_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||
imageWidth, imageHeight, palette, left, top);
|
||||
imageWidth, palette, left, top);
|
||||
return;
|
||||
case 24:
|
||||
blit24_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||
imageWidth, imageHeight, palette, left, top);
|
||||
imageWidth, palette, left, top);
|
||||
return;
|
||||
case 32:
|
||||
blit32_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||
imageWidth, imageHeight, palette, left, top);
|
||||
imageWidth, palette, left, top);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -189,17 +188,19 @@ boot_splash_set_stage(int stage)
|
||||
if (sInfo == NULL || stage < 0 || stage >= BOOT_SPLASH_STAGE_MAX)
|
||||
return;
|
||||
|
||||
// TODO: Use placement info from images.h
|
||||
int x = sInfo->width / 2 - kSplashIconsWidth / 2;
|
||||
int y = sInfo->height / 2 - kSplashLogoHeight / 2;
|
||||
y = y + kSplashLogoHeight;
|
||||
int iconsHalfHeight = kSplashIconsHeight / 2;
|
||||
int width = min_c(kSplashIconsWidth, sInfo->width);
|
||||
int height = min_c(iconsHalfHeight, sInfo->height);
|
||||
int placementX = max_c(0, min_c(100, kSplashIconsPlacementX));
|
||||
int placementY = max_c(0, min_c(100, kSplashIconsPlacementY));
|
||||
|
||||
int stageLeftEdge = kSplashIconsWidth * stage / BOOT_SPLASH_STAGE_MAX;
|
||||
int stageRightEdge = kSplashIconsWidth * (stage + 1)
|
||||
/ BOOT_SPLASH_STAGE_MAX;
|
||||
int x = (sInfo->width - width) * placementX / 100;
|
||||
int y = (sInfo->height - height) * placementY / 100;
|
||||
|
||||
int stageLeftEdge = width * stage / BOOT_SPLASH_STAGE_MAX;
|
||||
int stageRightEdge = width * (stage + 1) / BOOT_SPLASH_STAGE_MAX;
|
||||
|
||||
blit_cropped(kSplashIconsImage, NULL, stageLeftEdge, 0, stageRightEdge,
|
||||
kSplashIconsHeight / 2, kSplashIconsWidth, kSplashIconsHeight, NULL,
|
||||
x, y);
|
||||
iconsHalfHeight, kSplashIconsWidth, NULL, x, y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user