mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +00:00
Some dirty rectangle related code
svn-id: r35267
This commit is contained in:
parent
c69cacfe2d
commit
5d1e3fd03e
@ -171,6 +171,8 @@ void HitZone::draw(SagaEngine *vm, int color) {
|
|||||||
} else {
|
} else {
|
||||||
if (pointsCount > 2) {
|
if (pointsCount > 2) {
|
||||||
// Otherwise draw a polyline
|
// 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);
|
vm->_gfx->drawPolyLine(points, pointsCount, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -204,14 +204,22 @@ void Render::drawScene() {
|
|||||||
_system->updateScreen();
|
_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() {
|
void Render::drawDirtyRects() {
|
||||||
if (_fullRefresh) {
|
if (_fullRefresh) {
|
||||||
_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
|
_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), _vm->_gfx->getBackBufferWidth(), 0, 0,
|
||||||
_vm->_gfx->getBackBufferWidth(), _vm->_gfx->getBackBufferHeight());
|
_vm->_gfx->getBackBufferWidth(), _vm->_gfx->getBackBufferHeight());
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// TODO: check if dirty rectangles are intersecting or contained within each other
|
|
||||||
|
|
||||||
Common::List<Common::Rect>::const_iterator it;
|
Common::List<Common::Rect>::const_iterator it;
|
||||||
for (it = _dirtyRects.begin(); it != _dirtyRects.end(); ++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());
|
g_system->copyRectToScreen(_vm->_gfx->getBackBufferPixels(), it->width(), it->left, it->top, it->width(), it->height());
|
||||||
|
@ -79,9 +79,7 @@ public:
|
|||||||
return &_backGroundSurface;
|
return &_backGroundSurface;
|
||||||
}
|
}
|
||||||
|
|
||||||
void addDirtyRect(Common::Rect rect) {
|
void addDirtyRect(Common::Rect rect);
|
||||||
_dirtyRects.push_back(rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearDirtyRects() {
|
void clearDirtyRects() {
|
||||||
_dirtyRects.clear();
|
_dirtyRects.clear();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user