From 8fd12bed10e92315d718bbbbd181c89c49d55f0f Mon Sep 17 00:00:00 2001
From: Andrey Cherepanov <cas@altlinux.org>
Date: Thu, 30 May 2019 14:48:58 +0300
Subject: [PATCH] Fix Plymouth theme

---
 bootsplash/theme.script | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/bootsplash/theme.script b/bootsplash/theme.script
index 7435372..dc64601 100644
--- a/bootsplash/theme.script
+++ b/bootsplash/theme.script
@@ -115,7 +115,7 @@ Plymouth.SetDisplayPasswordFunction(display_password_callback);
 # Define bar size and position
 bar_height = 36;
 bar_x = Window.GetWidth() * 0.10; # 10% from left edge
-bar_y = Window.GetHeight() * 0.85; # from bar bottom to bottom screen edge: 10%
+bar_y = Window.GetHeight() / 2; # top progressbar edge should be at middle of screen
 bar_width = Window.GetWidth() * 0.80; # 80% of screen width
 
 # Progress background spite
@@ -127,17 +127,22 @@ progress_bg.sprite.SetZ (5);
 
 # Progress bar sprite
 progress_bar.raw = Image ("progress_bar.png");
-progress_bar.image = imgscale (progress_bar.raw, 1);
+progress_bar.image = progress_bar.raw;
 
 # Maximum number of sprites
 steps = Math.Int (bar_width/18);
 
+# Show first step
+progress_bar.sprites[0] = Sprite ();
+progress_bar.sprites[0].SetImage (progress_bar.image);
+progress_bar.sprites[0].SetPosition (bar_x, bar_y);
+progress_bar.sprites[0].SetZ (10);
+
 fun progress_callback (duration, progress)
 {
-  # Redraw progress_bar with appropriate width with step 20% with 5% ahead
-  step = Math.Int ((progress+0.05) / steps) + 1;
+  step = Math.Int ((progress+0.05) * steps) + 1;
   if ( step > steps ) step = steps;
-  for( i=0; i<step; i++ )
+  for( i=0; i<step; i++ ) {
     progress_bar.sprites[i] = Sprite ();
     progress_bar.sprites[i].SetImage (progress_bar.image);
     progress_bar.sprites[i].SetPosition (bar_x+i*18, bar_y);