diff --git a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m index bbe54aeb8113e429e9bfa1e0b27a06df20201df6..fcc0e0df23f52b933ebe24bb87803a2e644e573c 100644 --- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m +++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m @@ -290,8 +290,8 @@ SplashEventLoop(Splash * splash) { 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); } diff --git a/src/share/native/sun/awt/splashscreen/splashscreen_impl.c b/src/share/native/sun/awt/splashscreen/splashscreen_impl.c index 437f81a8632b0c81d8c26a9054e067282d6268f6..021447e287f30e4f835a8bb71d2fe2e65ea7eff4 100644 --- a/src/share/native/sun/awt/splashscreen/splashscreen_impl.c +++ b/src/share/native/sun/awt/splashscreen/splashscreen_impl.c @@ -111,8 +111,9 @@ SplashDone(Splash * splash) 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 @@ void 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 @@ SplashUpdateScreenData(Splash * splash) 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 @@ BitmapToYXBandedRectangles(ImageRect * pSrcRect, RECT_T * out) 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) { diff --git a/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c b/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c index e43ebcaf2366242e4d316220242b84e406d1e07c..930f7ebbeb94d5e18d73836c0be671eca1dcfd02 100644 --- a/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c +++ b/src/solaris/native/sun/awt/splashscreen/splashscreen_sys.c @@ -577,8 +577,8 @@ SplashEventLoop(Splash * splash) { 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);