aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorFilippos Karapetis2008-12-07 00:27:39 +0000
committerFilippos Karapetis2008-12-07 00:27:39 +0000
commit5d1e3fd03e21e9486168783b31d18d8738b2a559 (patch)
treea3f672bd9f9fbe7bf1864bb208d309616a857a62 /engines/saga
parentc69cacfe2d0c66cc82c9194080bfb9bdeac28845 (diff)
downloadscummvm-rg350-5d1e3fd03e21e9486168783b31d18d8738b2a559.tar.gz
scummvm-rg350-5d1e3fd03e21e9486168783b31d18d8738b2a559.tar.bz2
scummvm-rg350-5d1e3fd03e21e9486168783b31d18d8738b2a559.zip
Some dirty rectangle related code
svn-id: r35267
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/objectmap.cpp2
-rw-r--r--engines/saga/render.cpp14
-rw-r--r--engines/saga/render.h4
3 files changed, 14 insertions, 6 deletions
diff --git a/engines/saga/objectmap.cpp b/engines/saga/objectmap.cpp
index d10c4ffaa7..d259472d3d 100644
--- a/engines/saga/objectmap.cpp
+++ b/engines/saga/objectmap.cpp
@@ -171,6 +171,8 @@ void HitZone::draw(SagaEngine *vm, int color) {
} else {
if (pointsCount > 2) {
// Otherwise draw a polyline
+ // Do a full refresh so that the polyline can be shown
+ vm->_render->setFullRefresh(true);
vm->_gfx->drawPolyLine(points, pointsCount, color);
}
}
diff --git a/engines/saga/render.cpp b/engines/saga/render.cpp
index e78e6f9947..85448bc412 100644
--- a/engines/saga/render.cpp
+++ b/engines/saga/render.cpp
@@ -204,14 +204,22 @@ void Render::drawScene() {
_system->updateScreen();
}
+void Render::addDirtyRect(Common::Rect rect) {
+ // Check if the new rectangle is contained within another in the list
+ Common::List<Common::Rect>::const_iterator it;
+ for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
+ if (it->contains(rect))
+ return;
+ }
+
+ _dirtyRects.push_back(rect);
+}
+
void Render::drawDirtyRects() {
if (_fullRefresh) {
_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
_vm->_gfx->getBackBufferWidth(), _vm->_gfx->getBackBufferHeight());
} else {
-
- // TODO: check if dirty rectangles are intersecting or contained within each other
-
Common::List<Common::Rect>::const_iterator it;
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++it) {
g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), it->width(), it->left, it->top, it->width(), it->height());
diff --git a/engines/saga/render.h b/engines/saga/render.h
index 772bbca1a6..8fffed4cc1 100644
--- a/engines/saga/render.h
+++ b/engines/saga/render.h
@@ -79,9 +79,7 @@ public:
return &_backGroundSurface;
}
- void addDirtyRect(Common::Rect rect) {
- _dirtyRects.push_back(rect);
- }
+ void addDirtyRect(Common::Rect rect);
void clearDirtyRects() {
_dirtyRects.clear();