diff options
author | Filippos Karapetis | 2008-12-08 22:07:14 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-12-08 22:07:14 +0000 |
commit | e27c494371660dc08e15af8038c8d7145be90ed4 (patch) | |
tree | 78d3d4d5eb881d32cc35e250b98fdc546aab022f | |
parent | 3334af5507db24208ca8a6f1aa8852281a017f82 (diff) | |
download | scummvm-rg350-e27c494371660dc08e15af8038c8d7145be90ed4.tar.gz scummvm-rg350-e27c494371660dc08e15af8038c8d7145be90ed4.tar.bz2 scummvm-rg350-e27c494371660dc08e15af8038c8d7145be90ed4.zip |
Some more dirty rectangle changes (still incomplete)
svn-id: r35288
-rw-r--r-- | engines/saga/isomap.cpp | 2 | ||||
-rw-r--r-- | engines/saga/render.cpp | 11 | ||||
-rw-r--r-- | engines/saga/scene.cpp | 4 | ||||
-rw-r--r-- | engines/saga/sprite.cpp | 5 |
4 files changed, 12 insertions, 10 deletions
diff --git a/engines/saga/isomap.cpp b/engines/saga/isomap.cpp index 682ad83e89..45202cc0ed 100644 --- a/engines/saga/isomap.cpp +++ b/engines/saga/isomap.cpp @@ -882,7 +882,7 @@ void IsoMap::drawTile(uint16 tileIndex, const Point &point, const Location *loca int rectX = MAX<int>(drawPoint.x, 0); int rectY = MAX<int>(drawPoint.y, 0); int rectX2 = MIN<int>(drawPoint.x + SAGA_ISOTILE_WIDTH, _tileClip.right); - int rectY2 = MIN<int>(drawPoint.y + height, _tileClip.bottom); + int rectY2 = lowBound; _vm->_render->addDirtyRect(Common::Rect(rectX, rectY, rectX2, rectY2)); } diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp index f3e3279bfe..063cc4c757 100644 --- a/engines/saga/render.cpp +++ b/engines/saga/render.cpp @@ -207,8 +207,8 @@ void Render::addDirtyRect(Common::Rect rect) { // Clip rectangle int x1 = MAX<int>(rect.left, 0); int y1 = MAX<int>(rect.top, 0); - int x2 = MIN<int>(rect.width(), _backGroundSurface.w); - int y2 = MIN<int>(rect.height(), _backGroundSurface.h); + int x2 = MIN<int>(rect.right, _backGroundSurface.w); + int y2 = MIN<int>(rect.bottom, _backGroundSurface.h); if (x2 > x1 && y2 > y1) { Common::Rect rectClipped(x1, y1, x2, y2); // Check if the new rectangle is contained within another in the list @@ -216,8 +216,11 @@ void Render::addDirtyRect(Common::Rect rect) { for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { if (it->contains(rectClipped)) return; + if (rectClipped.contains(*it)) { + _dirtyRects.erase(it); + break; // we need to break now, as the list is changed + } } - _dirtyRects.push_back(rectClipped); } } @@ -226,6 +229,7 @@ void Render::restoreChangedRects() { if (!_fullRefresh) { Common::List<Common::Rect>::const_iterator it; for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { + //_backGroundSurface.frameRect(*it, 1); // DEBUG g_system->copyRectToScreen((byte *)_backGroundSurface.pixels, _backGroundSurface.w, it->left, it->top, it->width(), it->height()); } } @@ -236,6 +240,7 @@ void Render::drawDirtyRects() { if (!_fullRefresh) { Common::List<Common::Rect>::const_iterator it; for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) { + //_backGroundSurface.frameRect(*it, 2); // DEBUG g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _backGroundSurface.w, it->left, it->top, it->width(), it->height()); } } else { diff --git a/engines/saga/scene.cpp b/engines/saga/scene.cpp index f53e6321c7..c2c3a7d350 100644 --- a/engines/saga/scene.cpp +++ b/engines/saga/scene.cpp @@ -589,9 +589,6 @@ void Scene::loadScene(LoadSceneParams *loadSceneParams) { Event *q_event; static PalEntry current_pal[PAL_ENTRIES]; - // Since we are loading a new scene, do a full refresh - _vm->_render->setFullRefresh(true); - if (loadSceneParams->transitionType == kTransitionFade) _vm->_interface->setFadeMode(kFadeOut); @@ -1185,6 +1182,7 @@ void Scene::endScene() { _vm->_scene->getBGInfo(bgInfo); _vm->_render->getBackGroundSurface()->blit(bgInfo.bounds, bgInfo.buffer); + _vm->_render->addDirtyRect(bgInfo.bounds); } else { _vm->_gfx->getBackBufferRect(rect); _vm->_render->getBackGroundSurface()->blit(rect, (const byte *)_vm->_gfx->getBackBufferPixels()); diff --git a/engines/saga/sprite.cpp b/engines/saga/sprite.cpp index 6507b6ebb3..7c5f13ef27 100644 --- a/engines/saga/sprite.cpp +++ b/engines/saga/sprite.cpp @@ -253,7 +253,7 @@ void Sprite::drawClip(const Rect &clipRect, const Point &spritePointer, int widt srcRowPointer += width; } - _vm->_render->addDirtyRect(Common::Rect(spritePointer.x, spritePointer.y, spritePointer.x + clipWidth, spritePointer.y + clipHeight)); + _vm->_render->addDirtyRect(clipRect); } void Sprite::draw(const Rect &clipRect, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) { @@ -395,8 +395,7 @@ void Sprite::drawOccluded(const Rect &clipRect, SpriteList &spriteList, int spri sourceRowPointer += width; } - _vm->_render->addDirtyRect(Common::Rect(clipData.destPoint.x, clipData.destPoint.y, - clipData.destPoint.x + clipData.drawWidth, clipData.destPoint.y + clipData.drawHeight)); + _vm->_render->addDirtyRect(clipRect); } void Sprite::decodeRLEBuffer(const byte *inputBuffer, size_t inLength, size_t outLength) { |