aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-01-31 20:19:47 +0000
committerJohannes Schickel2006-01-31 20:19:47 +0000
commit669f86705d18d08ab69c602925995b602617027d (patch)
tree1ed612deffbd099a9b0a3a83d82308b3caed6d81
parent1976ac6250686c6af19eefa3afef5eb426012eb5 (diff)
downloadscummvm-rg350-669f86705d18d08ab69c602925995b602617027d.tar.gz
scummvm-rg350-669f86705d18d08ab69c602925995b602617027d.tar.bz2
scummvm-rg350-669f86705d18d08ab69c602925995b602617027d.zip
Implements the usage of cached backgrounds in the old theme as well,
that should fix redrawing bugs with the about dialog. Also I displayed cached background usage in the console for now, since it produces redraw bugs with the old theme (maybe someone with knowledge how redrawing of that dialog is handled should look at that). svn-id: r20337
-rw-r--r--gui/console.cpp6
-rw-r--r--gui/theme.cpp25
-rw-r--r--gui/theme.h2
3 files changed, 27 insertions, 6 deletions
diff --git a/gui/console.cpp b/gui/console.cpp
index a2418772e2..ef9472e841 100644
--- a/gui/console.cpp
+++ b/gui/console.cpp
@@ -122,7 +122,7 @@ void ConsoleDialog::open() {
// visible screen area, then shift it down in handleTickle() over a
// certain period of time.
- _drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
+ _drawingHints |= THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
_y = -_h;
_slideTime = g_system->getMillis();
@@ -145,7 +145,9 @@ void ConsoleDialog::drawDialog() {
int y = _y + 2;
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _drawingHints);
- _drawingHints = THEME_HINT_SAVE_BACKGROUND;
+ // FIXME: for the old theme the frame around the console vanishes
+ // when any action is processed if we enable this
+ // _drawingHints &= ~THEME_HINT_FIRST_DRAW;
for (int line = 0; line < _linesPerPage; line++) {
int x = _x + 1;
diff --git a/gui/theme.cpp b/gui/theme.cpp
index 301db8aada..adb79e111e 100644
--- a/gui/theme.cpp
+++ b/gui/theme.cpp
@@ -132,10 +132,16 @@ void ThemeClassic::resetDrawArea() {
void ThemeClassic::drawDialogBackground(const Common::Rect &r, uint16 hints, kState state) {
if (!_initOk)
return;
-
+
restoreBackground(r);
+
+ if ((hints & THEME_HINT_SAVE_BACKGROUND) && !(hints & THEME_HINT_FIRST_DRAW)) {
+ addDirtyRect(r);
+ return;
+ }
+
box(r.left, r.top, r.width(), r.height(), _color, _shadowcolor);
- addDirtyRect(r);
+ addDirtyRect(r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
}
void ThemeClassic::drawText(const Common::Rect &r, const Common::String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis) {
@@ -391,6 +397,7 @@ void ThemeClassic::drawLineSeparator(const Common::Rect &r, kState state) {
void ThemeClassic::restoreBackground(Common::Rect r) {
r.clip(_screen.w, _screen.h);
+ r.clip(_drawArea);
#ifndef OLDGUI_TRANSPARENCY
_screen.fillRect(r, _bgcolor);
#else
@@ -415,12 +422,24 @@ void ThemeClassic::restoreBackground(Common::Rect r) {
#endif
}
-bool ThemeClassic::addDirtyRect(Common::Rect r) {
+bool ThemeClassic::addDirtyRect(Common::Rect r, bool save) {
// TODO: implement proper dirty rect handling
// FIXME: problem with the 'pitch'
r.clip(_screen.w, _screen.h);
r.clip(_drawArea);
_system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(r.left, r.top), _screen.w, r.left, r.top, r.width(), r.height());
+ if (_dialog && save) {
+ if (_dialog->screen.pixels) {
+ OverlayColor *dst = (OverlayColor*)_dialog->screen.getBasePtr(r.left, r.top);
+ const OverlayColor *src = (const OverlayColor*)_screen.getBasePtr(r.left, r.top);
+ int h = r.height();
+ while (h--) {
+ memcpy(dst, src, r.width()*sizeof(OverlayColor));
+ dst += _dialog->screen.w;
+ src += _screen.w;
+ }
+ }
+ }
return true;
}
diff --git a/gui/theme.h b/gui/theme.h
index 903d54fb14..3316c001eb 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -202,7 +202,7 @@ public:
void drawLineSeparator(const Common::Rect &r, kState state);
private:
void restoreBackground(Common::Rect r);
- bool addDirtyRect(Common::Rect r);
+ bool addDirtyRect(Common::Rect r, bool save = false);
void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB);
void box(int x, int y, int width, int height);