8023057: Enhance start up image display
authorvadim
Fri, 13 Sep 2013 13:17:52 +0400
changeset 22312 dd65107de257
parent 22311 46afd8601158
child 22313 5f4e692842fb
8023057: Enhance start up image display Reviewed-by: anthony, serb, mschoene
jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m
jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.c
jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c
--- a/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Fri Sep 13 15:37:43 2013 +0800
+++ b/jdk/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Fri Sep 13 13:17:52 2013 +0400
@@ -290,8 +290,8 @@
         SplashUnlock(splash);
         rc = poll(pfd, 1, timeout);
         SplashLock(splash);
-        if (splash->isVisible>0 && SplashTime() >= splash->time +
-                splash->frames[splash->currentFrame].delay) {
+        if (splash->isVisible > 0 && splash->currentFrame >= 0 &&
+                SplashTime() >= splash->time + splash->frames[splash->currentFrame].delay) {
             SplashNextFrame(splash);
             SplashRedrawWindow(splash);
         }
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.c	Fri Sep 13 15:37:43 2013 +0800
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_impl.c	Fri Sep 13 13:17:52 2013 +0400
@@ -111,8 +111,9 @@
 int
 SplashIsStillLooping(Splash * splash)
 {
-    if (splash->currentFrame < 0)
+    if (splash->currentFrame < 0) {
         return 0;
+    }
     return splash->loopCount != 1 ||
         splash->currentFrame + 1 < splash->frameCount;
 }
@@ -121,17 +122,22 @@
 SplashUpdateScreenData(Splash * splash)
 {
     ImageRect srcRect, dstRect;
+    if (splash->currentFrame < 0) {
+        return;
+    }
 
     initRect(&srcRect, 0, 0, splash->width, splash->height, 1,
         splash->width * sizeof(rgbquad_t),
         splash->frames[splash->currentFrame].bitmapBits, &splash->imageFormat);
-    if (splash->screenData)
+    if (splash->screenData) {
         free(splash->screenData);
+    }
     splash->screenStride = splash->width * splash->screenFormat.depthBytes;
-    if (splash->byteAlignment > 1)
+    if (splash->byteAlignment > 1) {
         splash->screenStride =
             (splash->screenStride + splash->byteAlignment - 1) &
             ~(splash->byteAlignment - 1);
+    }
     splash->screenData = malloc(splash->height * splash->screenStride);
     initRect(&dstRect, 0, 0, splash->width, splash->height, 1,
         splash->screenStride, splash->screenData, &splash->screenFormat);
@@ -146,16 +152,19 @@
 void
 SplashNextFrame(Splash * splash)
 {
-    if (splash->currentFrame < 0)
+    if (splash->currentFrame < 0) {
         return;
+    }
     do {
-        if (!SplashIsStillLooping(splash))
+        if (!SplashIsStillLooping(splash)) {
             return;
+        }
         splash->time += splash->frames[splash->currentFrame].delay;
         if (++splash->currentFrame >= splash->frameCount) {
             splash->currentFrame = 0;
-            if (splash->loopCount > 0)
+            if (splash->loopCount > 0) {
                 splash->loopCount--;
+            }
         }
     } while (splash->time + splash->frames[splash->currentFrame].delay -
         SplashTime() <= 0);
@@ -183,8 +192,9 @@
                 pSrc += pSrcRect->depthBytes;
                 ++i;
             }
-            if (i >= pSrcRect->numSamples)
+            if (i >= pSrcRect->numSamples) {
                 break;
+            }
             i0 = i;
             while (i < pSrcRect->numSamples &&
                    getRGBA(pSrc, pSrcRect->format) >= ALPHA_THRESHOLD) {
--- a/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Fri Sep 13 15:37:43 2013 +0800
+++ b/jdk/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c	Fri Sep 13 13:17:52 2013 +0400
@@ -577,8 +577,8 @@
         SplashUnlock(splash);
         rc = poll(pfd, 2, timeout);
         SplashLock(splash);
-        if (splash->isVisible>0 && SplashTime() >= splash->time +
-                splash->frames[splash->currentFrame].delay) {
+        if (splash->isVisible > 0 && splash->currentFrame >= 0 &&
+                SplashTime() >= splash->time + splash->frames[splash->currentFrame].delay) {
             SplashNextFrame(splash);
             SplashUpdateShape(splash);
             SplashRedrawWindow(splash);