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;
|
srcP += _buffer2.pitch;
|
||||||
destP += _screen->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) {
|
void AccessEngine::playVideo(int videoNum, const Common::Point &pt) {
|
||||||
|
|
|
@ -38,9 +38,10 @@ class SpriteFrame;
|
||||||
class ASurface : public Graphics::Surface {
|
class ASurface : public Graphics::Surface {
|
||||||
private:
|
private:
|
||||||
Graphics::Surface _savedBlock;
|
Graphics::Surface _savedBlock;
|
||||||
Common::Rect _savedBounds;
|
|
||||||
|
|
||||||
void flipHorizontal(ASurface &dest);
|
void flipHorizontal(ASurface &dest);
|
||||||
|
protected:
|
||||||
|
Common::Rect _savedBounds;
|
||||||
public:
|
public:
|
||||||
static int _leftSkip, _rightSkip;
|
static int _leftSkip, _rightSkip;
|
||||||
static int _topSkip, _bottomSkip;
|
static int _topSkip, _bottomSkip;
|
||||||
|
@ -92,6 +93,8 @@ public:
|
||||||
|
|
||||||
virtual void copyBlock(ASurface *src, const Common::Rect &bounds);
|
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::Point &destPos);
|
||||||
|
|
||||||
void copyTo(ASurface *dest, const Common::Rect &bounds);
|
void copyTo(ASurface *dest, const Common::Rect &bounds);
|
||||||
|
@ -100,8 +103,6 @@ public:
|
||||||
|
|
||||||
void saveBlock(const Common::Rect &bounds);
|
void saveBlock(const Common::Rect &bounds);
|
||||||
|
|
||||||
void restoreBlock();
|
|
||||||
|
|
||||||
void drawRect();
|
void drawRect();
|
||||||
|
|
||||||
void moveBufferLeft();
|
void moveBufferLeft();
|
||||||
|
|
|
@ -68,6 +68,8 @@ void Screen::clearScreen() {
|
||||||
clearBuffer();
|
clearBuffer();
|
||||||
if (_vesaMode)
|
if (_vesaMode)
|
||||||
_vm->_clearSummaryFlag = true;
|
_vm->_clearSummaryFlag = true;
|
||||||
|
|
||||||
|
addDirtyRect(Common::Rect(0, 0, this->w, this->h));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::setDisplayScan() {
|
void Screen::setDisplayScan() {
|
||||||
|
@ -87,9 +89,15 @@ void Screen::setPanel(int num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::updateScreen() {
|
void Screen::updateScreen() {
|
||||||
g_system->copyRectToScreen((byte *)getPixels(), this->pitch, 0, 0,
|
for (uint i = 0; i < _dirtyRects.size(); ++i) {
|
||||||
this->w, this->h);
|
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();
|
g_system->updateScreen();
|
||||||
|
_dirtyRects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::setInitialPalettte() {
|
void Screen::setInitialPalettte() {
|
||||||
|
@ -239,6 +247,12 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
|
||||||
destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff);
|
destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff);
|
||||||
|
|
||||||
copyRectToSurface(*src, destBounds.left, destBounds.top, bounds);
|
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) {
|
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
|
} // End of namespace Access
|
||||||
|
|
|
@ -63,6 +63,7 @@ private:
|
||||||
int _startCycle;
|
int _startCycle;
|
||||||
int _cycleStart;
|
int _cycleStart;
|
||||||
int _endCycle;
|
int _endCycle;
|
||||||
|
Common::Array<Common::Rect> _dirtyRects;
|
||||||
|
|
||||||
void updatePalette();
|
void updatePalette();
|
||||||
public:
|
public:
|
||||||
|
@ -83,6 +84,8 @@ public:
|
||||||
bool _screenChangeFlag;
|
bool _screenChangeFlag;
|
||||||
public:
|
public:
|
||||||
virtual void copyBlock(ASurface *src, const Common::Rect &bounds);
|
virtual void copyBlock(ASurface *src, const Common::Rect &bounds);
|
||||||
|
|
||||||
|
virtual void restoreBlock();
|
||||||
public:
|
public:
|
||||||
Screen(AccessEngine *vm);
|
Screen(AccessEngine *vm);
|
||||||
|
|
||||||
|
@ -157,6 +160,8 @@ public:
|
||||||
void cyclePaletteForward();
|
void cyclePaletteForward();
|
||||||
|
|
||||||
void cyclePaletteBackwards();
|
void cyclePaletteBackwards();
|
||||||
|
|
||||||
|
void addDirtyRect(const Common::Rect &r);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End of namespace Access
|
} // End of namespace Access
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue