From ff7c1086af432ff5125c109b7ecebe5ddb1ebd40 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Sat, 16 Apr 2005 12:41:43 +0000 Subject: When recreating the canvas, do a full redraw so that all the dialogs behind the credits show. Until we have a new canvas, don't draw any credits text, or it too will show up on the canvas. The latter, at the very least, was a bug in my original patch. svn-id: r17621 --- gui/about.cpp | 13 +++++++++++-- gui/about.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'gui') diff --git a/gui/about.cpp b/gui/about.cpp index d23ce9c0a4..a659392194 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -121,6 +121,7 @@ void AboutDialog::open() { _modifiers = 0; _willClose = false; _canvas.pixels = NULL; + _screenHasChanged = false; Dialog::open(); } @@ -138,6 +139,7 @@ void AboutDialog::drawDialog() { // static background for the remainder of the credits. g_gui.blendRect(_x, _y, _w, _h, g_gui._bgcolor); g_gui.copyToSurface(&_canvas, _x, _y, _w, _h); + _screenHasChanged = false; } g_gui.drawSurface(_canvas, _x, _y); @@ -212,6 +214,11 @@ void AboutDialog::drawDialog() { void AboutDialog::handleTickle() { + // We're in the process of doing a full redraw. This will be used as + // background for the text, so we don't want any text on it. + if (_screenHasChanged) + return; + const uint32 t = getMillis(); int scrollOffset = ((int)t - (int)_scrollTime) / kScrollMillisPerPixel; if (scrollOffset > 0) { @@ -235,10 +242,12 @@ void AboutDialog::handleTickle() { } void AboutDialog::handleScreenChanged() { - // The screen has changed. Reset the canvas, to ensure it gets - // refreshed next time a redraw takes place. + // The screen has changed. Reset the canvas, and issue a full redraw. + // Until we have a new canvas, don't draw any credits text. free(_canvas.pixels); _canvas.pixels = NULL; + _screenHasChanged = true; + draw(); } void AboutDialog::handleMouseUp(int x, int y, int button, int clickCount) { diff --git a/gui/about.h b/gui/about.h index 65dbb49f40..89cb61df22 100644 --- a/gui/about.h +++ b/gui/about.h @@ -37,6 +37,7 @@ protected: byte _modifiers; bool _willClose; Graphics::Surface _canvas; + bool _screenHasChanged; public: AboutDialog(); -- cgit v1.2.3