* Give boot stages a more meaningful name, make the max stage count known.

* Calculate icon offset from stage in splash.cpp, remove hard coded placement
  values. Draw only icon, not the whole image from top/left to right of
  icon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2008-03-18 13:14:18 +00:00
parent 48e299e2ef
commit 7d85665d0f
3 changed files with 24 additions and 42 deletions

View File

@ -35,13 +35,15 @@ extern "C" {
#endif
enum {
BOOT_SPLASH_STAGE_1 = 0,
BOOT_SPLASH_STAGE_2,
BOOT_SPLASH_STAGE_3,
BOOT_SPLASH_STAGE_4,
BOOT_SPLASH_STAGE_5,
BOOT_SPLASH_STAGE_6,
BOOT_SPLASH_STAGE_7
BOOT_SPLASH_STAGE_1_INIT_MODULES = 0,
BOOT_SPLASH_STAGE_2_BOOTSTRAP_FS,
BOOT_SPLASH_STAGE_3_INIT_DEVICES,
BOOT_SPLASH_STAGE_4_MOUNT_BOOT_FS,
BOOT_SPLASH_STAGE_5_INIT_CPU_MODULES,
BOOT_SPLASH_STAGE_6_INIT_VM_MODULES,
BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT,
BOOT_SPLASH_STAGE_MAX // keep this at the end
};
status_t boot_splash_fb_init(struct kernel_args *args);

View File

@ -226,7 +226,7 @@ main2(void *unused)
boot_splash_fb_init(&sKernelArgs);
TRACE("Init modules\n");
boot_splash_set_stage(BOOT_SPLASH_STAGE_1);
boot_splash_set_stage(BOOT_SPLASH_STAGE_1_INIT_MODULES);
module_init(&sKernelArgs);
// ToDo: the preloaded image debug data is placed in the kernel args, and
@ -250,11 +250,11 @@ main2(void *unused)
/* bootstrap all the filesystems */
TRACE("Bootstrap file systems\n");
boot_splash_set_stage(BOOT_SPLASH_STAGE_2);
boot_splash_set_stage(BOOT_SPLASH_STAGE_2_BOOTSTRAP_FS);
vfs_bootstrap_file_systems();
TRACE("Init Device Manager\n");
boot_splash_set_stage(BOOT_SPLASH_STAGE_3);
boot_splash_set_stage(BOOT_SPLASH_STAGE_3_INIT_DEVICES);
device_manager_init(&sKernelArgs);
TRACE("Add preloaded old-style drivers\n");
@ -266,15 +266,15 @@ main2(void *unused)
int_init_post_device_manager(&sKernelArgs);
TRACE("Mount boot file system\n");
boot_splash_set_stage(BOOT_SPLASH_STAGE_4);
boot_splash_set_stage(BOOT_SPLASH_STAGE_4_MOUNT_BOOT_FS);
vfs_mount_boot_file_system(&sKernelArgs);
// CPU specific modules may now be available
boot_splash_set_stage(BOOT_SPLASH_STAGE_5);
boot_splash_set_stage(BOOT_SPLASH_STAGE_5_INIT_CPU_MODULES);
cpu_init_post_modules(&sKernelArgs);
TRACE("vm_init_post_modules\n");
boot_splash_set_stage(BOOT_SPLASH_STAGE_6);
boot_splash_set_stage(BOOT_SPLASH_STAGE_6_INIT_VM_MODULES);
vm_init_post_modules(&sKernelArgs);
TRACE("debug_init_post_modules\n");
@ -283,7 +283,7 @@ main2(void *unused)
TRACE("device_manager_init_post_modules\n");
device_manager_init_post_modules(&sKernelArgs);
boot_splash_set_stage(BOOT_SPLASH_STAGE_7);
boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT);
// start the init process
{
const char *shellArgs[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", NULL};

View File

@ -335,37 +335,17 @@ boot_splash_set_stage(int stage)
if (!sBootSplash.enabled)
return;
if (stage < 0 || stage >= BOOT_SPLASH_STAGE_MAX)
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 stageOffset = 0;
switch (stage) {
case BOOT_SPLASH_STAGE_1:
stageOffset = 32;
break;
case BOOT_SPLASH_STAGE_2:
stageOffset = 74;
break;
case BOOT_SPLASH_STAGE_3:
stageOffset = 116;
break;
case BOOT_SPLASH_STAGE_4:
stageOffset = 158;
break;
case BOOT_SPLASH_STAGE_5:
stageOffset = 200;
break;
case BOOT_SPLASH_STAGE_6:
stageOffset = 242;
break;
case BOOT_SPLASH_STAGE_7:
default:
stageOffset = iconsWidth;
break;
}
boot_splash_fb_blit_cropped(iconsImage, 0, 0, stageOffset, 32,
iconsWidth, iconsHeight, iconsPalette, x, y );
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 );
}