diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 5 | ||||
-rw-r--r-- | engines/access/asurface.h | 7 | ||||
-rw-r--r-- | engines/access/screen.cpp | 22 | ||||
-rw-r--r-- | engines/access/screen.h | 5 |
4 files changed, 34 insertions, 5 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index d0bd3e6eed..b67aebfcc0 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -396,6 +396,11 @@ void AccessEngine::copyBF2Vid() { srcP += _buffer2.pitch; destP += _screen->pitch; } + + // Add dirty rect for affected area + Common::Rect r(_screen->_vWindowBytesWide, _screen->_vWindowLinesTall); + r.moveTo(_screen->_windowXAdd, _screen->_windowYAdd + _screen->_screenYOff); + _screen->addDirtyRect(r); } void AccessEngine::playVideo(int videoNum, const Common::Point &pt) { diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 273578c830..0ce08bbb5c 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -38,9 +38,10 @@ class SpriteFrame; class ASurface : public Graphics::Surface { private: Graphics::Surface _savedBlock; - Common::Rect _savedBounds; void flipHorizontal(ASurface &dest); +protected: + Common::Rect _savedBounds; public: static int _leftSkip, _rightSkip; static int _topSkip, _bottomSkip; @@ -92,6 +93,8 @@ public: virtual void copyBlock(ASurface *src, const Common::Rect &bounds); + virtual void restoreBlock(); + void copyTo(ASurface *dest, const Common::Point &destPos); void copyTo(ASurface *dest, const Common::Rect &bounds); @@ -100,8 +103,6 @@ public: void saveBlock(const Common::Rect &bounds); - void restoreBlock(); - void drawRect(); void moveBufferLeft(); diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 318eb66516..9ccad28931 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -68,6 +68,8 @@ void Screen::clearScreen() { clearBuffer(); if (_vesaMode) _vm->_clearSummaryFlag = true; + + addDirtyRect(Common::Rect(0, 0, this->w, this->h)); } void Screen::setDisplayScan() { @@ -87,9 +89,15 @@ void Screen::setPanel(int num) { } void Screen::updateScreen() { - g_system->copyRectToScreen((byte *)getPixels(), this->pitch, 0, 0, - this->w, this->h); + for (uint i = 0; i < _dirtyRects.size(); ++i) { + const Common::Rect &r = _dirtyRects[i]; + const byte *srcP = (const byte *)getBasePtr(r.left, r.top); + g_system->copyRectToScreen(srcP, this->pitch, r.left, r.top, + r.width(), r.height()); + } + g_system->updateScreen(); + _dirtyRects.clear(); } void Screen::setInitialPalettte() { @@ -239,6 +247,12 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) { destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff); copyRectToSurface(*src, destBounds.left, destBounds.top, bounds); + addDirtyRect(destBounds); +} + +void Screen::restoreBlock() { + ASurface::restoreBlock(); + addDirtyRect(_savedBounds); } void Screen::setPaletteCycle(int startCycle, int endCycle, int timer) { @@ -276,4 +290,8 @@ void Screen::cyclePaletteBackwards() { } } +void Screen::addDirtyRect(const Common::Rect &r) { + _dirtyRects.push_back(r); +} + } // End of namespace Access diff --git a/engines/access/screen.h b/engines/access/screen.h index 8875ce12b7..93da5aa8b3 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -63,6 +63,7 @@ private: int _startCycle; int _cycleStart; int _endCycle; + Common::Array<Common::Rect> _dirtyRects; void updatePalette(); public: @@ -83,6 +84,8 @@ public: bool _screenChangeFlag; public: virtual void copyBlock(ASurface *src, const Common::Rect &bounds); + + virtual void restoreBlock(); public: Screen(AccessEngine *vm); @@ -157,6 +160,8 @@ public: void cyclePaletteForward(); void cyclePaletteBackwards(); + + void addDirtyRect(const Common::Rect &r); }; } // End of namespace Access |