Skip to content

Commit

Permalink
Fixed|Busy Mode: Screen capture for transition-free busy mode
Browse files Browse the repository at this point in the history
If there will be no animated transition at the end of the busy mode,
we must capture the entire view because busy mode currently takes
over the entire view. Otherwise, the sidebar would seem to disappear
during busy mode.
  • Loading branch information
skyjake committed Sep 16, 2013
1 parent a2bf919 commit 1b250aa
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
4 changes: 4 additions & 0 deletions doomsday/client/include/busymode.h
Expand Up @@ -43,6 +43,10 @@ boolean BusyMode_IsWorkerThread(uint threadId);
/// @return @c true if the current thread is the busy task worker.
boolean BusyMode_InWorkerThread(void);

#ifdef __CLIENT__
boolean BusyMode_IsTransitionAnimated(void);
#endif

/// @return Current busy task, else @c NULL.
BusyTask* BusyMode_CurrentTask(void);

Expand Down
7 changes: 7 additions & 0 deletions doomsday/client/src/busymode.cpp
Expand Up @@ -230,6 +230,13 @@ static int runTask(BusyTask* task)
#endif
}

#ifdef __CLIENT__
boolean BusyMode_IsTransitionAnimated(void)
{
return busyWillAnimateTransition;
}
#endif

static void preBusySetup(int initialMode)
{
#ifdef __CLIENT__
Expand Down
19 changes: 13 additions & 6 deletions doomsday/client/src/ui/widgets/busywidget.cpp
Expand Up @@ -144,15 +144,22 @@ bool BusyWidget::handleEvent(Event const &)

void BusyWidget::grabTransitionScreenshot()
{
GLTexture::Size size(rule().width().valuei() / 2,
rule().height().valuei() / 2);
//GLTexture::Size size(rule().width().valuei() / 2,
// rule().height().valuei() / 2);

Rectanglei grabRect = Rectanglei::fromSize(root().window().canvas().size());

if(BusyMode_IsTransitionAnimated())
{
// Animation transitions are drawn only inside LegacyWidget, so just
// grab that portion of the screen.
grabRect = root().window().game().rule().recti();
}

// Grab the game view's rectangle, as that's where the transition will be drawn.
GLuint grabbed = root().window().grabAsTexture(
root().window().game().rule().recti(),
ClientWindow::GrabHalfSized);
GLuint grabbed = root().window().grabAsTexture(grabRect, ClientWindow::GrabHalfSized);

d->transitionTex.reset(new GLTexture(grabbed, size));
d->transitionTex.reset(new GLTexture(grabbed, grabRect.size() / 2));
d->uTex = *d->transitionTex;
}

Expand Down
2 changes: 1 addition & 1 deletion doomsday/libgui/src/canvaswindow.cpp
Expand Up @@ -231,7 +231,7 @@ duint CanvasWindow::grabAsTexture(Rectanglei const &area, GrabMode mode) const
QSize size;
if(mode == GrabHalfSized)
{
size = QSize(width()/2, height()/2);
size = QSize(area.width()/2, area.height()/2);
}
return d->canvas->grabAsTexture(
QRect(area.left(), area.top(), area.width(), area.height()), size);
Expand Down

0 comments on commit 1b250aa

Please sign in to comment.