diff options
author | Paul Gilbert | 2013-02-26 07:57:30 -0500 |
---|---|---|
committer | Paul Gilbert | 2013-03-02 10:53:11 -0500 |
commit | c3bab0aecbb00f55493a0816c217d33dc9359793 (patch) | |
tree | d5c6dd6a325eb590a0461da3d9718cb19f7c40f0 | |
parent | 54924de6cbd07e8b8cb2eb91067a0d31d08b55c8 (diff) | |
download | scummvm-rg350-c3bab0aecbb00f55493a0816c217d33dc9359793.tar.gz scummvm-rg350-c3bab0aecbb00f55493a0816c217d33dc9359793.tar.bz2 scummvm-rg350-c3bab0aecbb00f55493a0816c217d33dc9359793.zip |
HOPKINS: Cleaned up the addDirtyRect method
-rw-r--r-- | engines/hopkins/graphics.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 31332324fe..ea65ad7432 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -1103,29 +1103,25 @@ void GraphicsManager::resetVesaSegment() { // Add VESA Segment void GraphicsManager::addDirtyRect(int x1, int y1, int x2, int y2) { - int tempX = x1; bool addFlag = true; - if (x2 > _maxX) - x2 = _maxX; - if (y2 > _maxY) - y2 = _maxY; - if (x1 < _minX) - tempX = _minX; - if (y1 < _minY) - y1 = _minY; + + x1 = CLIP(x1, _minX, _maxX); + y1 = CLIP(y1, _minY, _maxY); + x2 = CLIP(x2, _minX, _maxX); + y2 = CLIP(y2, _minY, _maxY); for (int blocIndex = 0; blocIndex <= _dirtyRectCount; blocIndex++) { BlocItem &bloc = _dirtyRects[blocIndex]; - if (bloc._activeFl && tempX >= bloc._x1 && x2 <= bloc._x2 && y1 >= bloc._y1 && y2 <= bloc._y2) + if (bloc._activeFl && x1 >= bloc._x1 && x2 <= bloc._x2 && y1 >= bloc._y1 && y2 <= bloc._y2) addFlag = false; }; - if (addFlag) { + if (addFlag && (x2 > x1) && (y2 > y1)) { assert(_dirtyRectCount < DIRTY_RECTS_SIZE); BlocItem &bloc = _dirtyRects[++_dirtyRectCount]; bloc._activeFl = true; - bloc._x1 = tempX; + bloc._x1 = x1; bloc._x2 = x2; bloc._y1 = y1; bloc._y2 = y2; |