From 9314daa11cb2eb8d4c4ecbe1c00fc044ba271f3d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 13 Dec 2014 22:06:58 -0500 Subject: [PATCH] ACCESS: Dirty rect handling for bubble boxes --- engines/access/asurface.h | 4 ++-- engines/access/inventory.cpp | 2 +- engines/access/screen.cpp | 8 +++++++- engines/access/screen.h | 2 ++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 0ce08bbb5c53..ffa22d58e5f6 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -95,6 +95,8 @@ class ASurface : public Graphics::Surface { virtual void restoreBlock(); + virtual void drawRect(); + void copyTo(ASurface *dest, const Common::Point &destPos); void copyTo(ASurface *dest, const Common::Rect &bounds); @@ -103,8 +105,6 @@ class ASurface : public Graphics::Surface { void saveBlock(const Common::Rect &bounds); - void drawRect(); - void moveBufferLeft(); void moveBufferRight(); diff --git a/engines/access/inventory.cpp b/engines/access/inventory.cpp index acba60433f54..20c9976a3b45 100644 --- a/engines/access/inventory.cpp +++ b/engines/access/inventory.cpp @@ -171,7 +171,7 @@ int InventoryManager::newDisplayInv() { // The original was testing the vesa mode too. // We removed this check as we don't use pre-rendering if (!_invRefreshFlag) { - screen.clearBuffer(); + screen.clearScreen(); screen.setPalette(); } diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 9ccad289312a..98dbdb4e9c8c 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -251,8 +251,13 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) { } void Screen::restoreBlock() { - ASurface::restoreBlock(); addDirtyRect(_savedBounds); + ASurface::restoreBlock(); +} + +void Screen::drawRect() { + addDirtyRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2)); + ASurface::drawRect(); } void Screen::setPaletteCycle(int startCycle, int endCycle, int timer) { @@ -292,6 +297,7 @@ void Screen::cyclePaletteBackwards() { void Screen::addDirtyRect(const Common::Rect &r) { _dirtyRects.push_back(r); + assert(r.isValidRect() && r.width() > 0 && r.height() > 0); } } // End of namespace Access diff --git a/engines/access/screen.h b/engines/access/screen.h index 93da5aa8b3ef..c43a03c9dcba 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -86,6 +86,8 @@ class Screen: public ASurface { virtual void copyBlock(ASurface *src, const Common::Rect &bounds); virtual void restoreBlock(); + + virtual void drawRect(); public: Screen(AccessEngine *vm);