Skip to content

Commit

Permalink
Fixed|Busy Mode: Don’t hold on an obsolete transition frame
Browse files Browse the repository at this point in the history
There may be a redundant request to render a transition frame,
however, if one comes some time later, we should respect the updated
request as the game state probably has changed already.
  • Loading branch information
skyjake committed Dec 15, 2013
1 parent aae6a42 commit 8044fe3
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions doomsday/client/src/ui/widgets/busywidget.cpp
Expand Up @@ -40,6 +40,7 @@ DENG_GUI_PIMPL(BusyWidget)
typedef DefaultVertexBuf VertexBuf;

ProgressWidget *progress;
Time frameDrawnAt;
GLFramebuffer transitionFrame;
Drawable drawable;
GLUniform uTex;
Expand Down Expand Up @@ -161,16 +162,22 @@ bool BusyWidget::handleEvent(Event const &)
return true;
}

static TimeDelta const TRANSITION_FRAME_VALID_DURATION = 0.1; // seconds

void BusyWidget::renderTransitionFrame()
{
LOG_AS("BusyWidget");

if(d->haveTransitionFrame())
if(d->haveTransitionFrame() && d->frameDrawnAt.since() < TRANSITION_FRAME_VALID_DURATION)
{
// We already have a valid frame, no need to render again.
LOG_DEBUG("Skipping rendering of transition frame (got one already)");
return;
}

// We'll have an up-to-date frame after this.
d->frameDrawnAt = Time();

DENG_ASSERT_IN_MAIN_THREAD();
DENG_ASSERT_GL_CONTEXT_ACTIVE();

Expand All @@ -193,7 +200,10 @@ void BusyWidget::renderTransitionFrame()
GLuint grabbed = root().window().grabAsTexture(grabRect, ClientWindow::GrabHalfSized);*/

d->transitionFrame.resize(grabRect.size());
d->transitionFrame.glInit();
if(!d->transitionFrame.isReady())
{
d->transitionFrame.glInit();
}

GLState::push()
.setTarget(d->transitionFrame.target())
Expand Down

0 comments on commit 8044fe3

Please sign in to comment.