aboutsummaryrefslogtreecommitdiff
path: root/engines/access/screen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/access/screen.cpp')
-rw-r--r--engines/access/screen.cpp101
1 files changed, 13 insertions, 88 deletions
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index aa15abd59a..7da9dfc429 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -69,8 +69,6 @@ void Screen::clearScreen() {
clearBuffer();
if (_vesaMode)
_vm->_clearSummaryFlag = true;
-
- addDirtyRect(Common::Rect(0, 0, this->w, this->h));
}
void Screen::setDisplayScan() {
@@ -89,28 +87,14 @@ void Screen::setPanel(int num) {
_msVirtualOffset = _virtualOffsetsTable[num];
}
-void Screen::updateScreen() {
+void Screen::update() {
if (_vm->_startup >= 0) {
if (--_vm->_startup == -1)
_fadeIn = true;
return;
}
-
- // Merge the dirty rects
- mergeDirtyRects();
-
- // Loop through copying dirty areas to the physical screen
- Common::List<Common::Rect>::iterator i;
- for (i = _dirtyRects.begin(); i != _dirtyRects.end(); ++i) {
- const Common::Rect &r = *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());
- }
-
- // Signal the physical screen to update
- g_system->updateScreen();
- _dirtyRects.clear();
+ markAllDirty();//****DEBUG****
+ Graphics::Screen::update();
}
void Screen::setInitialPalettte() {
@@ -153,7 +137,7 @@ void Screen::loadRawPalette(Common::SeekableReadStream *stream) {
void Screen::updatePalette() {
g_system->getPaletteManager()->setPalette(&_tempPalette[0], 0, PALETTE_COUNT);
- updateScreen();
+ update();
}
void Screen::savePalette() {
@@ -269,7 +253,7 @@ void Screen::restoreScreen() {
_screenYOff = _screenSave._screenYOff;
}
-void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
+void Screen::copyBlock(BaseSurface *src, const Common::Rect &bounds) {
Common::Rect destBounds = bounds;
destBounds.translate(_windowXAdd, _windowYAdd + _screenYOff);
@@ -280,37 +264,22 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
void Screen::restoreBlock() {
if (!_savedBounds.isEmpty())
addDirtyRect(_savedBounds);
- ASurface::restoreBlock();
+ BaseSurface::restoreBlock();
}
void Screen::drawRect() {
addDirtyRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2));
- ASurface::drawRect();
+ BaseSurface::drawRect();
}
void Screen::drawBox() {
addDirtyRect(Common::Rect(_orgX1, _orgY1, _orgX2, _orgY2));
- ASurface::drawBox();
-}
-
-void Screen::transBlitFrom(ASurface *src, const Common::Point &destPos) {
- addDirtyRect(Common::Rect(destPos.x, destPos.y, destPos.x + src->w, destPos.y + src->h));
- ASurface::transBlitFrom(src, destPos);
+ BaseSurface::drawBox();
}
-void Screen::transBlitFrom(ASurface *src, const Common::Rect &bounds) {
- addDirtyRect(bounds);
- ASurface::transBlitFrom(src, bounds);
-}
-
-void Screen::blitFrom(const Graphics::Surface &src) {
- addDirtyRect(Common::Rect(0, 0, src.w, src.h));
- ASurface::blitFrom(src);
-}
-
-void Screen::copyBuffer(Graphics::Surface *src) {
+void Screen::copyBuffer(Graphics::ManagedSurface *src) {
addDirtyRect(Common::Rect(0, 0, src->w, src->h));
- ASurface::copyBuffer(src);
+ BaseSurface::copyBuffer(src);
}
void Screen::setPaletteCycle(int startCycle, int endCycle, int timer) {
@@ -331,10 +300,10 @@ void Screen::cyclePaletteBackwards() {
_vm->_timers[6]._flag++;
byte *pStart = &_rawPalette[_cycleStart * 3];
byte *pEnd = &_rawPalette[_endCycle * 3];
-
+
for (int idx = _startCycle; idx < _endCycle; ++idx) {
g_system->getPaletteManager()->setPalette(pStart, idx, 1);
-
+
pStart += 3;
if (pStart == pEnd)
pStart = &_rawPalette[_cycleStart * 3];
@@ -349,51 +318,7 @@ void Screen::cyclePaletteBackwards() {
}
void Screen::flashPalette(int count) {
- warning("TODO: Implement flashPalette");
-}
-
-void Screen::addDirtyRect(const Common::Rect &r) {
- _dirtyRects.push_back(r);
- assert(r.isValidRect() && r.width() > 0 && r.height() > 0);
+ // No implementation needed in ScummVM
}
-void Screen::mergeDirtyRects() {
- Common::List<Common::Rect>::iterator rOuter, rInner;
-
- // Ensure dirty rect list has at least two entries
- rOuter = _dirtyRects.begin();
- for (int i = 0; i < 2; ++i, ++rOuter) {
- if (rOuter == _dirtyRects.end())
- return;
- }
-
- // Process the dirty rect list to find any rects to merge
- for (rOuter = _dirtyRects.begin(); rOuter != _dirtyRects.end(); ++rOuter) {
- rInner = rOuter;
- while (++rInner != _dirtyRects.end()) {
-
- if ((*rOuter).intersects(*rInner)) {
- // these two rectangles overlap or
- // are next to each other - merge them
-
- unionRectangle(*rOuter, *rOuter, *rInner);
-
- // remove the inner rect from the list
- _dirtyRects.erase(rInner);
-
- // move back to beginning of list
- rInner = rOuter;
- }
- }
- }
-}
-
-bool Screen::unionRectangle(Common::Rect &destRect, const Common::Rect &src1, const Common::Rect &src2) {
- destRect = src1;
- destRect.extend(src2);
-
- return !destRect.isEmpty();
-}
-
-
} // End of namespace Access