* 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
|
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
|
uint32 *start = (uint32 *)(sFrameBuffer
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 4 * left);
|
+ 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;
|
src += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += width * 3;
|
data += imageWidth * 3;
|
||||||
start = (uint32 *)((addr_t)start
|
start = (uint32 *)((addr_t)start
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||||
}
|
}
|
||||||
@@ -626,7 +627,8 @@ blit32(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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
|
uint8 *start = (uint8 *)sFrameBuffer
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 3 * left;
|
+ 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;
|
src += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += width * 3;
|
data += imageWidth * 3;
|
||||||
start = start + gKernelArgs.frame_buffer.bytes_per_row;
|
start = start + gKernelArgs.frame_buffer.bytes_per_row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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
|
uint16 *start = (uint16 *)(sFrameBuffer
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
|
+ 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;
|
src += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += width * 3;
|
data += imageWidth * 3;
|
||||||
start = (uint16 *)((addr_t)start
|
start = (uint16 *)((addr_t)start
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||||
}
|
}
|
||||||
@@ -673,7 +676,8 @@ blit16(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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
|
uint16 *start = (uint16 *)(sFrameBuffer
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
|
+ 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;
|
src += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += width * 3;
|
data += imageWidth * 3;
|
||||||
start = (uint16 *)((addr_t)start
|
start = (uint16 *)((addr_t)start
|
||||||
+ gKernelArgs.frame_buffer.bytes_per_row);
|
+ gKernelArgs.frame_buffer.bytes_per_row);
|
||||||
}
|
}
|
||||||
@@ -697,7 +701,7 @@ blit15(const uint8 *data, uint16 width, uint16 height, uint16 left, uint16 top)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
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)
|
const uint8 *palette, uint16 left, uint16 top)
|
||||||
{
|
{
|
||||||
if (!data || !palette)
|
if (!data || !palette)
|
||||||
@@ -711,13 +715,13 @@ blit8(const uint8 *data, uint16 width, uint16 height,
|
|||||||
|
|
||||||
for (int32 i = 0; i < height; i++) {
|
for (int32 i = 0; i < height; i++) {
|
||||||
memcpy((void *)(start + gKernelArgs.frame_buffer.bytes_per_row * i),
|
memcpy((void *)(start + gKernelArgs.frame_buffer.bytes_per_row * i),
|
||||||
&data[i * width], width);
|
&data[i * imageWidth], width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
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)
|
const uint8 *palette, uint16 left, uint16 top)
|
||||||
{
|
{
|
||||||
if (!data || !palette)
|
if (!data || !palette)
|
||||||
@@ -768,22 +772,25 @@ blit4(const uint8 *data, uint16 width, uint16 height,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
blit_image(const uint8 *data, const uint8* indexedData, uint16 width, uint16 height,
|
blit_image(const uint8 *data, const uint8* indexedData, uint16 width,
|
||||||
const uint8 *palette, uint16 left, uint16 top)
|
uint16 height, uint16 imageWidth, const uint8 *palette, uint16 left,
|
||||||
|
uint16 top)
|
||||||
{
|
{
|
||||||
switch (gKernelArgs.frame_buffer.depth) {
|
switch (gKernelArgs.frame_buffer.depth) {
|
||||||
case 4:
|
case 4:
|
||||||
return blit4(indexedData, width, height, palette, left, top);
|
return blit4(indexedData, width, height, imageWidth, palette,
|
||||||
|
left, top);
|
||||||
case 8:
|
case 8:
|
||||||
return blit8(indexedData, width, height, palette, left, top);
|
return blit8(indexedData, width, height, imageWidth, palette,
|
||||||
|
left, top);
|
||||||
case 15:
|
case 15:
|
||||||
return blit15(data, width, height, left, top);
|
return blit15(data, width, height, imageWidth, left, top);
|
||||||
case 16:
|
case 16:
|
||||||
return blit16(data, width, height, left, top);
|
return blit16(data, width, height, imageWidth, left, top);
|
||||||
case 24:
|
case 24:
|
||||||
return blit24(data, width, height, left, top);
|
return blit24(data, width, height, imageWidth, left, top);
|
||||||
case 32:
|
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);
|
gKernelArgs.frame_buffer.physical_buffer.size);
|
||||||
|
|
||||||
// TODO: support indexed versions of the images!
|
// TODO: support indexed versions of the images!
|
||||||
// TODO: support compressed RGB image data
|
// TODO: support compressed RGB image data (simple RLE?)
|
||||||
|
|
||||||
// render splash logo
|
// render splash logo
|
||||||
int x = gKernelArgs.frame_buffer.width / 2 - kSplashLogoWidth / 2;
|
int width = min_c(kSplashLogoWidth, gKernelArgs.frame_buffer.width);
|
||||||
int y = gKernelArgs.frame_buffer.height / 2 - kSplashLogoHeight / 2;
|
int height = min_c(kSplashLogoHeight, gKernelArgs.frame_buffer.height);
|
||||||
blit_image(kSplashLogoImage, NULL, kSplashLogoWidth, kSplashLogoHeight,
|
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);
|
NULL, x, y);
|
||||||
|
|
||||||
// render initial (grayed out) icons
|
// render initial (grayed out) icons
|
||||||
x = gKernelArgs.frame_buffer.width / 2 - kSplashIconsWidth / 2;
|
// the grayed out version is the lower half of the icons image
|
||||||
y = y + kSplashLogoHeight;
|
|
||||||
uint16 iconsHalfHeight = kSplashIconsHeight / 2;
|
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
|
const uint8* lowerHalfIconImage = kSplashIconsImage
|
||||||
+ (kSplashIconsWidth * iconsHalfHeight) * 3;
|
+ (kSplashIconsWidth * iconsHalfHeight) * 3;
|
||||||
blit_image(lowerHalfIconImage, NULL, kSplashIconsWidth, iconsHalfHeight,
|
blit_image(lowerHalfIconImage, NULL, width, height, kSplashIconsWidth,
|
||||||
NULL, x, y);
|
NULL, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ static struct frame_buffer_boot_info *sInfo;
|
|||||||
static void
|
static void
|
||||||
blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
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;
|
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||||
uint16* start = (uint16*)(sInfo->frame_buffer
|
uint16* start = (uint16*)(sInfo->frame_buffer
|
||||||
@@ -64,7 +64,7 @@ blit15_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
|||||||
static void
|
static void
|
||||||
blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
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;
|
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||||
uint16* start = (uint16*)(sInfo->frame_buffer
|
uint16* start = (uint16*)(sInfo->frame_buffer
|
||||||
@@ -91,7 +91,7 @@ blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
|||||||
static void
|
static void
|
||||||
blit24_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
blit24_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
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;
|
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||||
uint8* start = (uint8*)(sInfo->frame_buffer
|
uint8* start = (uint8*)(sInfo->frame_buffer
|
||||||
@@ -117,7 +117,7 @@ blit24_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
|||||||
static void
|
static void
|
||||||
blit32_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
blit32_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
||||||
uint16 imageRight, uint16 imageBottom, uint16 imageWidth,
|
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;
|
data += (imageWidth * imageTop + imageLeft) * 3;
|
||||||
uint32* start = (uint32*)(sInfo->frame_buffer
|
uint32* start = (uint32*)(sInfo->frame_buffer
|
||||||
@@ -141,25 +141,24 @@ blit32_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop,
|
|||||||
static void
|
static void
|
||||||
blit_cropped(const uint8* data, const uint8* indexedData,
|
blit_cropped(const uint8* data, const uint8* indexedData,
|
||||||
uint16 imageLeft, uint16 imageTop, uint16 imageRight, uint16 imageBottom,
|
uint16 imageLeft, uint16 imageTop, uint16 imageRight, uint16 imageBottom,
|
||||||
uint16 imageWidth, uint16 imageHeight, const uint8 *palette,
|
uint16 imageWidth, const uint8 *palette, uint16 left, uint16 top)
|
||||||
uint16 left, uint16 top)
|
|
||||||
{
|
{
|
||||||
switch (sInfo->depth) {
|
switch (sInfo->depth) {
|
||||||
case 15:
|
case 15:
|
||||||
blit15_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
blit15_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||||
imageWidth, imageHeight, palette, left, top);
|
imageWidth, palette, left, top);
|
||||||
return;
|
return;
|
||||||
case 16:
|
case 16:
|
||||||
blit16_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
blit16_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||||
imageWidth, imageHeight, palette, left, top);
|
imageWidth, palette, left, top);
|
||||||
return;
|
return;
|
||||||
case 24:
|
case 24:
|
||||||
blit24_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
blit24_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||||
imageWidth, imageHeight, palette, left, top);
|
imageWidth, palette, left, top);
|
||||||
return;
|
return;
|
||||||
case 32:
|
case 32:
|
||||||
blit32_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
blit32_cropped(data, imageLeft, imageTop, imageRight, imageBottom,
|
||||||
imageWidth, imageHeight, palette, left, top);
|
imageWidth, palette, left, top);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -189,17 +188,19 @@ boot_splash_set_stage(int stage)
|
|||||||
if (sInfo == NULL || stage < 0 || stage >= BOOT_SPLASH_STAGE_MAX)
|
if (sInfo == NULL || stage < 0 || stage >= BOOT_SPLASH_STAGE_MAX)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: Use placement info from images.h
|
int iconsHalfHeight = kSplashIconsHeight / 2;
|
||||||
int x = sInfo->width / 2 - kSplashIconsWidth / 2;
|
int width = min_c(kSplashIconsWidth, sInfo->width);
|
||||||
int y = sInfo->height / 2 - kSplashLogoHeight / 2;
|
int height = min_c(iconsHalfHeight, sInfo->height);
|
||||||
y = y + kSplashLogoHeight;
|
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 x = (sInfo->width - width) * placementX / 100;
|
||||||
int stageRightEdge = kSplashIconsWidth * (stage + 1)
|
int y = (sInfo->height - height) * placementY / 100;
|
||||||
/ BOOT_SPLASH_STAGE_MAX;
|
|
||||||
|
int stageLeftEdge = width * stage / BOOT_SPLASH_STAGE_MAX;
|
||||||
|
int stageRightEdge = width * (stage + 1) / BOOT_SPLASH_STAGE_MAX;
|
||||||
|
|
||||||
blit_cropped(kSplashIconsImage, NULL, stageLeftEdge, 0, stageRightEdge,
|
blit_cropped(kSplashIconsImage, NULL, stageLeftEdge, 0, stageRightEdge,
|
||||||
kSplashIconsHeight / 2, kSplashIconsWidth, kSplashIconsHeight, NULL,
|
iconsHalfHeight, kSplashIconsWidth, NULL, x, y);
|
||||||
x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user