diff options
-rw-r--r-- | gui/console.cpp | 6 | ||||
-rw-r--r-- | gui/theme.cpp | 25 | ||||
-rw-r--r-- | gui/theme.h | 2 |
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); |