ACCESS: Beginnings of dirty rect handling for screen
This commit is contained in:
parent
330cb5fb07
commit
98889efae5
4 changed files with 34 additions and 5 deletions
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue