From a639e39225791546bb308e7376ae2eb17aa196a5 Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Tue, 20 Apr 2010 13:00:31 +0000 Subject: - better handle if multihead have different size --- common/plymouth/mdv.script | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/common/plymouth/mdv.script b/common/plymouth/mdv.script index 598fb1c..0a60df9 100644 --- a/common/plymouth/mdv.script +++ b/common/plymouth/mdv.script @@ -1,5 +1,25 @@ # Mdv splashy like theme +Window.GetMaxWidth = fun (){ + i = 0; + width = 0; + while (Window.GetWidth(i)){ + width = Math.Max(width, Window.GetWidth(i)); + i++; + } + return width; +}; + +Window.GetMaxHeight = fun (){ + i = 0; + height = 0; + while (Window.GetHeight(i)){ + height = Math.Max(height, Window.GetHeight(i)); + i++; + } + return height; +}; + anim.imagecount = 32; anim.target_width = 0.5* 0.46 * Window.GetWidth(); anim.target_height = 0.5* 0.11 * Window.GetWidth(); @@ -35,11 +55,11 @@ else { anim.index = 0; motif.original_image = ImageNew("motif.png"); - motif.image = motif.original_image.Scale(motif.original_image.GetWidth() * Window.GetWidth() / background.original_image.GetWidth(), motif.original_image.GetHeight() * Window.GetHeight() / background.original_image.GetHeight()); + motif.image = motif.original_image.Scale(motif.original_image.GetWidth() * Window.GetMaxWidth() / background.original_image.GetWidth(), motif.original_image.GetHeight() * Window.GetMaxHeight() / background.original_image.GetHeight()); motif.sprite = SpriteNew(); motif.sprite.SetImage(motif.image); motif.sprite.SetOpacity(0); - motif.sprite.SetY((Window.GetHeight() - motif.image.GetHeight()) / 2); + motif.sprite.SetY((Window.GetMaxHeight() - motif.image.GetHeight()) / 2); if (Plymouth.GetMode() == "shutdown") { motif.opacity = 1; } @@ -50,14 +70,14 @@ else { ratio = logo.original_image.GetWidth() / logo.original_image.GetHeight(); reduction = 0.4; -logo.image = logo.original_image.Scale(reduction * Window.GetWidth() , reduction / ratio * Window.GetWidth()); +logo.image = logo.original_image.Scale(reduction * Window.GetMaxWidth() , reduction / ratio * Window.GetMaxWidth()); logo.sprite = SpriteNew(); logo.sprite.SetImage(logo.image); logo.opacity_angle = 0; -logo.sprite.SetX((Window.GetX() + Window.GetWidth() - logo.image.GetWidth()) / 2); +logo.sprite.SetX((Window.GetX() + Window.GetMaxWidth() - logo.image.GetWidth()) / 2); logo.sprite.SetY(Window.GetY() + 50); -background.image = background.original_image.Scale( Window.GetWidth() , Window.GetHeight()); +background.image = background.original_image.Scale(Window.GetMaxWidth() , Window.GetMaxHeight()); background.sprite = SpriteNew(); background.sprite.SetImage(background.image); background.sprite.SetPosition(Window.GetX(), Window.GetY(), -10); @@ -200,7 +220,7 @@ Plymouth.SetMessageFunction(display_message_callback); if (Plymouth.GetMode() == "suspend" || Plymouth.GetMode() == "resume") { progress_box.original_image = ImageNew("progress_box_background.png"); - progress_box.image = progress_box.original_image.Scale(Window.GetWidth() * 0.44, progress_box.original_image.GetHeight()); + progress_box.image = progress_box.original_image.Scale(Window.GetMaxWidth() * 0.44, progress_box.original_image.GetHeight()); progress_box.edge = ImageNew("progress_box_edge.png"); progress_box.left_edge_sprite = SpriteNew(); progress_box.right_edge_sprite = SpriteNew(); -- cgit v1.2.1