Ticket #1999: bootsplash.diff

File bootsplash.diff, 3.7 KB (added by stpere, 16 years ago)

The patch that allows positionning in images.h

  • src/system/kernel/boot_splash.cpp

     
    189189    if (sInfo == NULL || stage < 0 || stage >= BOOT_SPLASH_STAGE_MAX)
    190190        return;
    191191
    192     // TODO: Use placement info from images.h
    193     int x = sInfo->width / 2 - kSplashIconsWidth / 2;
    194     int y = sInfo->height / 2 - kSplashLogoHeight / 2;
    195     y = y + kSplashLogoHeight;
     192    int maxWidth = kSplashLogoWidth;
     193    if (maxWidth < kSplashIconsWidth) {
     194        maxWidth = kSplashIconsWidth;
     195    }
    196196
     197    int x = sInfo->width * kSplashHorizontalPos / 100 - maxWidth / 2;
     198    int y = sInfo->height * kSplashVerticalPos / 100 - kSplashIconsHeight / 2;
     199
     200    /* make sure the logo and icons are all within the framebuffer */
     201
     202    if (x < 0) {
     203        x = 0;
     204    }
     205
     206    x = x + ( maxWidth - kSplashIconsWidth ) / 2;
     207
     208    if (x + maxWidth > sInfo->width) {
     209        x = (sInfo->width - maxWidth) + (maxWidth - kSplashIconsWidth) / 2;
     210    }
     211
     212    if (y < kSplashLogoHeight) {
     213        y = kSplashLogoHeight;
     214    } else if (y + kSplashIconsHeight > sInfo->height) {
     215        y = sInfo->height - kSplashIconsHeight ;
     216    }
     217
     218
     219
     220
    197221    int stageLeftEdge = kSplashIconsWidth * stage / BOOT_SPLASH_STAGE_MAX;
    198222    int stageRightEdge = kSplashIconsWidth * (stage + 1)
    199223        / BOOT_SPLASH_STAGE_MAX;
  • src/system/boot/platform/bios_ia32/video.cpp

     
    861861    // TODO: support compressed RGB image data
    862862
    863863    // render splash logo
    864     int x = gKernelArgs.frame_buffer.width / 2 - kSplashLogoWidth / 2;
    865     int y = gKernelArgs.frame_buffer.height / 2 - kSplashLogoHeight / 2;
     864    int x = gKernelArgs.frame_buffer.width  * kSplashHorizontalPos / 100 - kSplashLogoWidth / 2;
     865    int y = gKernelArgs.frame_buffer.height * kSplashVerticalPos / 100 -   kSplashIconsHeight / 2 - kSplashLogoHeight;
     866
     867    int maxWidth = kSplashLogoWidth;
     868    if (maxWidth < kSplashIconsWidth) {
     869        maxWidth = kSplashIconsWidth;
     870    }
     871
     872    if (x < maxWidth - kSplashLogoWidth) {
     873        x = maxWidth - kSplashLogoWidth;
     874    }
     875
     876    if (y < 0) {
     877        y = 0;
     878    }
     879
     880    // in case some theme features larger icons than logo..
     881    x = x + ( maxWidth - kSplashLogoWidth ) / 2;
     882
     883    if (x + maxWidth >= gKernelArgs.frame_buffer.width) {
     884        x = (gKernelArgs.frame_buffer.width - maxWidth) + (maxWidth - kSplashLogoWidth) / 2;
     885    }
     886
     887    if (y + kSplashLogoHeight + kSplashIconsHeight >= gKernelArgs.frame_buffer.height) {
     888        y = gKernelArgs.frame_buffer.height - kSplashLogoHeight - kSplashIconsHeight;
     889    }
     890
    866891    blit_image(kSplashLogoImage, NULL, kSplashLogoWidth, kSplashLogoHeight,
    867892        NULL, x, y);
    868893
    869894    // render initial (grayed out) icons
    870     x = gKernelArgs.frame_buffer.width / 2 - kSplashIconsWidth / 2;
     895    x = x + (maxWidth - kSplashIconsWidth) / 2;
    871896    y = y + kSplashLogoHeight;
    872897    uint16 iconsHalfHeight = kSplashIconsHeight / 2;
    873898    const uint8* lowerHalfIconImage = kSplashIconsImage
  • headers/private/kernel/boot/images.h

     
    11// This file was generated by the generate_boot_screen build tool.
    22
     3static const int16 kSplashVerticalPos = 50;
     4static const int16 kSplashHorizontalPos = 50;
     5
    36static const uint16 kSplashLogoWidth = 397;
    47static const uint16 kSplashLogoHeight = 90;
    58static const uint8 kSplashLogoImage[] = {
     
    2134621349    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    2134721350    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    2134821351};
    21349