提交 a85eaeae 编写于 作者: V vadim

8023057: Enhance start up image display

Reviewed-by: anthony, serb, mschoene
上级 1964ea49
...@@ -290,8 +290,8 @@ SplashEventLoop(Splash * splash) { ...@@ -290,8 +290,8 @@ SplashEventLoop(Splash * splash) {
SplashUnlock(splash); SplashUnlock(splash);
rc = poll(pfd, 1, timeout); rc = poll(pfd, 1, timeout);
SplashLock(splash); SplashLock(splash);
if (splash->isVisible>0 && SplashTime() >= splash->time + if (splash->isVisible > 0 && splash->currentFrame >= 0 &&
splash->frames[splash->currentFrame].delay) { SplashTime() >= splash->time + splash->frames[splash->currentFrame].delay) {
SplashNextFrame(splash); SplashNextFrame(splash);
SplashRedrawWindow(splash); SplashRedrawWindow(splash);
} }
......
...@@ -111,8 +111,9 @@ SplashDone(Splash * splash) ...@@ -111,8 +111,9 @@ SplashDone(Splash * splash)
int int
SplashIsStillLooping(Splash * splash) SplashIsStillLooping(Splash * splash)
{ {
if (splash->currentFrame < 0) if (splash->currentFrame < 0) {
return 0; return 0;
}
return splash->loopCount != 1 || return splash->loopCount != 1 ||
splash->currentFrame + 1 < splash->frameCount; splash->currentFrame + 1 < splash->frameCount;
} }
...@@ -121,17 +122,22 @@ void ...@@ -121,17 +122,22 @@ void
SplashUpdateScreenData(Splash * splash) SplashUpdateScreenData(Splash * splash)
{ {
ImageRect srcRect, dstRect; ImageRect srcRect, dstRect;
if (splash->currentFrame < 0) {
return;
}
initRect(&srcRect, 0, 0, splash->width, splash->height, 1, initRect(&srcRect, 0, 0, splash->width, splash->height, 1,
splash->width * sizeof(rgbquad_t), splash->width * sizeof(rgbquad_t),
splash->frames[splash->currentFrame].bitmapBits, &splash->imageFormat); splash->frames[splash->currentFrame].bitmapBits, &splash->imageFormat);
if (splash->screenData) if (splash->screenData) {
free(splash->screenData); free(splash->screenData);
}
splash->screenStride = splash->width * splash->screenFormat.depthBytes; splash->screenStride = splash->width * splash->screenFormat.depthBytes;
if (splash->byteAlignment > 1) if (splash->byteAlignment > 1) {
splash->screenStride = splash->screenStride =
(splash->screenStride + splash->byteAlignment - 1) & (splash->screenStride + splash->byteAlignment - 1) &
~(splash->byteAlignment - 1); ~(splash->byteAlignment - 1);
}
splash->screenData = malloc(splash->height * splash->screenStride); splash->screenData = malloc(splash->height * splash->screenStride);
initRect(&dstRect, 0, 0, splash->width, splash->height, 1, initRect(&dstRect, 0, 0, splash->width, splash->height, 1,
splash->screenStride, splash->screenData, &splash->screenFormat); splash->screenStride, splash->screenData, &splash->screenFormat);
...@@ -146,17 +152,20 @@ SplashUpdateScreenData(Splash * splash) ...@@ -146,17 +152,20 @@ SplashUpdateScreenData(Splash * splash)
void void
SplashNextFrame(Splash * splash) SplashNextFrame(Splash * splash)
{ {
if (splash->currentFrame < 0) if (splash->currentFrame < 0) {
return; return;
}
do { do {
if (!SplashIsStillLooping(splash)) if (!SplashIsStillLooping(splash)) {
return; return;
}
splash->time += splash->frames[splash->currentFrame].delay; splash->time += splash->frames[splash->currentFrame].delay;
if (++splash->currentFrame >= splash->frameCount) { if (++splash->currentFrame >= splash->frameCount) {
splash->currentFrame = 0; splash->currentFrame = 0;
if (splash->loopCount > 0) if (splash->loopCount > 0) {
splash->loopCount--; splash->loopCount--;
} }
}
} while (splash->time + splash->frames[splash->currentFrame].delay - } while (splash->time + splash->frames[splash->currentFrame].delay -
SplashTime() <= 0); SplashTime() <= 0);
} }
...@@ -183,8 +192,9 @@ BitmapToYXBandedRectangles(ImageRect * pSrcRect, RECT_T * out) ...@@ -183,8 +192,9 @@ BitmapToYXBandedRectangles(ImageRect * pSrcRect, RECT_T * out)
pSrc += pSrcRect->depthBytes; pSrc += pSrcRect->depthBytes;
++i; ++i;
} }
if (i >= pSrcRect->numSamples) if (i >= pSrcRect->numSamples) {
break; break;
}
i0 = i; i0 = i;
while (i < pSrcRect->numSamples && while (i < pSrcRect->numSamples &&
getRGBA(pSrc, pSrcRect->format) >= ALPHA_THRESHOLD) { getRGBA(pSrc, pSrcRect->format) >= ALPHA_THRESHOLD) {
......
...@@ -577,8 +577,8 @@ SplashEventLoop(Splash * splash) { ...@@ -577,8 +577,8 @@ SplashEventLoop(Splash * splash) {
SplashUnlock(splash); SplashUnlock(splash);
rc = poll(pfd, 2, timeout); rc = poll(pfd, 2, timeout);
SplashLock(splash); SplashLock(splash);
if (splash->isVisible>0 && SplashTime() >= splash->time + if (splash->isVisible > 0 && splash->currentFrame >= 0 &&
splash->frames[splash->currentFrame].delay) { SplashTime() >= splash->time + splash->frames[splash->currentFrame].delay) {
SplashNextFrame(splash); SplashNextFrame(splash);
SplashUpdateShape(splash); SplashUpdateShape(splash);
SplashRedrawWindow(splash); SplashRedrawWindow(splash);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册