summaryrefslogtreecommitdiffstats
path: root/bsplash.inc
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
committerThierry Vignaud <tv@mandriva.org>2007-06-07 18:54:11 +0000
commit534f2f4437093bd78411126ef45de41fc6b93bf3 (patch)
tree1a9c1e259e6f2495ebcacf3cbd8cb7d3fdaaac2a /bsplash.inc
parent92072c3be58f5c77ff0fecdaf6617fe6fa4120e1 (diff)
downloadbootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.gz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.bz2
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.tar.xz
bootloader-theme-534f2f4437093bd78411126ef45de41fc6b93bf3.zip
reimport my latest checkout
Diffstat (limited to 'bsplash.inc')
-rw-r--r--bsplash.inc165
1 files changed, 165 insertions, 0 deletions
diff --git a/bsplash.inc b/bsplash.inc
new file mode 100644
index 0000000..b4a840a
--- /dev/null
+++ b/bsplash.inc
@@ -0,0 +1,165 @@
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+%
+% Boot loader splash code.
+%
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Some global vars.
+
+/.b_x 0 def
+/.b_y 1 def
+/.b_dx 2 def
+/.b_dy 3 def
+/.b_steps 4 def
+/.b_mask 5 def
+/.b_count 6 def
+/.b_w 7 def
+/.b_h 8 def
+/.b_back 9 def
+/.b_tmp1 10 def
+/.b_tmp2 11 def
+
+/bsplash.list [
+ [ 193 117 0 0 20 "mandriva.pcx" 0 0 0 .undef .undef .undef ]
+] def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Init splash.
+%
+% ( ) ==> ( )
+%
+/bsplash.init {
+ bsplash.list {
+ dup .b_mask get readimage over .b_mask rot put
+ dup .b_mask get dup .undef ne {
+ imgsize
+ 2 index .b_h rot put
+ over .b_w rot put
+
+ dup .b_x get over .b_y get moveto
+ dup .b_w get over .b_steps get 2 index .b_dx get abs mul add
+ over .b_h get 2 index .b_steps get 3 index .b_dy get abs mul add
+ savescreen over .b_back rot put
+
+ dup .b_w get 1 sub over .b_h get 1 sub savescreen over .b_tmp1 rot put
+ dup .b_w get 1 sub over .b_h get 1 sub savescreen over .b_tmp2 rot put
+ } {
+ pop
+ } ifelse
+ pop
+ } forall
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Free splash memory.
+%
+% ( ) ==> ( )
+%
+/bsplash.free {
+ bsplash.list {
+ dup .b_mask get free dup .b_mask .undef put
+ dup .b_back get free
+ dup .b_tmp1 get free
+ dup .b_tmp2 get free
+ pop
+ } forall
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Show boot loader splash.
+%
+% ( ) ==> ( )
+%
+/bsplash.show {
+ currentimage
+
+ "welcome.jpg" findfile /splash.file over def setimage
+
+ 0 0 moveto 0 0 image.size image
+
+ bsplash.init
+
+ 400000 usleep
+
+ {
+ 0 usleep
+ bsplash.run { exit } if
+ } loop
+
+ bsplash.free
+
+ setimage
+
+ splash.file free /splash.file .undef def
+
+} def
+
+
+% Run splash animations. Return 'true' when done.
+%
+% ( ) ==> ( true|false )
+%
+/bsplash.run {
+ true
+
+ bsplash.list {
+ dup .b_mask get .undef ne over .b_count get .undef ne and {
+ exch pop false exch
+
+ dup .b_count get 1 add over .b_count rot put
+
+ % count runs from 0 ... steps inclusive
+
+ dup .b_count get 0 ge {
+
+ % copy background
+ dup .b_dx get over .b_count get mul 10 div
+ over .b_dx get 2 index .b_steps get mul 10 div neg 0 max add
+ over .b_dy get 2 index .b_count get mul 10 div
+ 2 index .b_dy get 3 index .b_steps get mul 10 div neg 0 max add
+ moveto
+ dup .b_back get 0xff 2 index .b_tmp1 get blend
+
+ % we need 2 copies
+ dup .b_tmp2 get over .b_tmp1 get over length memcpy
+
+ % draw text
+ 0 0 moveto 0x333333 over .b_mask get 2 index .b_tmp1 get blend
+ 1 1 moveto white over .b_mask get 2 index .b_tmp1 get blend
+
+ % blend result with background
+ 0 0 moveto dup .b_tmp1 get over .b_count get 255 mul 2 index .b_steps get div 2 index .b_tmp2 get blend
+
+ % show result
+ dup .b_x get over .b_dx get 2 index .b_count get mul 10 div add
+ over .b_dx get 2 index .b_steps get mul 10 div neg 0 max add
+ over .b_y get 2 index .b_dy get 3 index .b_count get mul 10 div add
+ 2 index .b_dy get 3 index .b_steps get mul 10 div neg 0 max add
+ moveto
+ dup .b_tmp2 get restorescreen
+
+ } if
+
+ dup .b_count get over .b_steps get eq { dup .b_count .undef put } if
+ } if
+ pop
+ } forall
+
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Just wait.
+%
+% ( ) ==> ( )
+%
+/bsplash.done {
+ 1500000 usleep
+} def
+
+