aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-01-08 03:24:41 +0000
committerMax Horn2004-01-08 03:24:41 +0000
commit6222d6e643ed1a2c73ae9037bcd6b677c917f420 (patch)
tree5104eace4510c5c633fe69ae84fe95a1f05b333f
parentab2192761d77b1acfc7da2038d65c151ab048a70 (diff)
downloadscummvm-rg350-6222d6e643ed1a2c73ae9037bcd6b677c917f420.tar.gz
scummvm-rg350-6222d6e643ed1a2c73ae9037bcd6b677c917f420.tar.bz2
scummvm-rg350-6222d6e643ed1a2c73ae9037bcd6b677c917f420.zip
more cleanup
svn-id: r12234
-rw-r--r--scumm/akos.cpp18
-rw-r--r--scumm/charset.cpp6
-rw-r--r--scumm/debugger.cpp2
-rw-r--r--scumm/gfx.cpp20
-rw-r--r--scumm/object.cpp4
-rw-r--r--scumm/scumm.h5
-rw-r--r--scumm/verbs.cpp4
7 files changed, 21 insertions, 38 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp
index 03e4fcd436..36970f2684 100644
--- a/scumm/akos.cpp
+++ b/scumm/akos.cpp
@@ -674,7 +674,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
if (_actorHitX < rect.left || _actorHitX >= rect.right || _actorHitY < rect.top || _actorHitY >= rect.bottom)
return 0;
} else
- _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right, rect.top, rect.bottom, _actorID);
+ _vm->markRectAsDirty(kMainVirtScreen, rect, _actorID);
if (rect.top >= (int)_outheight || rect.bottom <= 0)
return 0;
@@ -767,21 +767,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) {
_vm->markRectAsDirty(kMainVirtScreen, clip.left, clip.right + 1, clip.top, clip.bottom + 1, _actorID);
- if (clip.top < 0) {
- clip.top = 0;
- }
-
- if (clip.bottom > maxh) {
- clip.bottom = maxh;
- }
-
- if (clip.left < 0) {
- clip.left = 0;
- }
-
- if (clip.right > maxw) {
- clip.right = maxw;
- }
+ clip.clip(maxw, maxh);
if ((clip.left >= clip.right) || (clip.top >= clip.bottom))
return 0;
diff --git a/scumm/charset.cpp b/scumm/charset.cpp
index 590e221b4e..2fc4abeab3 100644
--- a/scumm/charset.cpp
+++ b/scumm/charset.cpp
@@ -977,7 +977,7 @@ void CharsetRendererV3::printChar(int chr) {
mask_ptr = _vm->getMaskBuffer(_left, drawTop, 0);
useMask = (vs->number == kMainVirtScreen && !_ignoreCharsetMask);
- _vm->markRectAsDirty(vs->number, _left, _left + w, drawTop, drawTop + h, 0);
+ _vm->markRectAsDirty(vs->number, _left, _left + w, drawTop, drawTop + h);
if (vs->number == kMainVirtScreen)
_hasMask = true;
@@ -1083,7 +1083,7 @@ void CharsetRendererClassic::printChar(int chr) {
int drawTop = _top - vs->topline;
- _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY, 0);
+ _vm->markRectAsDirty(vs->number, _left, _left + width, drawTop, drawTop + height + offsY);
if (!vs->hasTwoBuffers)
_blitAlso = false;
@@ -1296,7 +1296,7 @@ void CharsetRendererNut::printChar(int chr) {
_hasMask = true;
_current->drawShadowChar(chr, _left, _top - _vm->_screenTop, _color, !_ignoreCharsetMask);
- _vm->markRectAsDirty(kMainVirtScreen, shadow.left, shadow.right, shadow.top, shadow.bottom, 0);
+ _vm->markRectAsDirty(kMainVirtScreen, shadow);
if (_str.left > _left)
_str.left = _left;
diff --git a/scumm/debugger.cpp b/scumm/debugger.cpp
index 9822651d93..fe9e8eec7d 100644
--- a/scumm/debugger.cpp
+++ b/scumm/debugger.cpp
@@ -709,7 +709,7 @@ void ScummDebugger::drawBox(int box) {
VirtScreen *vs = _vm->findVirtScreen(coords.ul.y);
if (vs != NULL)
- _vm->markRectAsDirty(vs->number, 0, vs->width, 0, vs->height, 0);
+ _vm->markRectAsDirty(vs->number, 0, vs->width, 0, vs->height);
_vm->drawDirtyScreenParts();
_vm->_system->update_screen();
}
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp
index 38555aa8ee..5044ad9f0e 100644
--- a/scumm/gfx.cpp
+++ b/scumm/gfx.cpp
@@ -570,25 +570,19 @@ void ScummEngine::restoreBG(Common::Rect rect, byte backColor) {
if ((vs = findVirtScreen(rect.top)) == NULL)
return;
+ if (rect.left > vs->width)
+ return;
+
topline = vs->topline;
rect.top -= topline;
rect.bottom -= topline;
- if (rect.left < 0)
- rect.left = 0;
- if (rect.right < 0)
- rect.right = 0;
- if (rect.left > vs->width)
- return;
- if (rect.right > vs->width)
- rect.right = vs->width;
- if (rect.bottom >= vs->height)
- rect.bottom = vs->height;
+ rect.clip(vs->width, vs->height);
- markRectAsDirty(vs->number, rect.left, rect.right, rect.top, rect.bottom, USAGE_BIT_RESTORED);
+ markRectAsDirty(vs->number, rect, USAGE_BIT_RESTORED);
- int offset = (rect.top) * vs->width + vs->xstart + rect.left;
+ int offset = rect.top * vs->width + vs->xstart + rect.left;
backbuff = vs->screenPtr + offset;
height = rect.height();
@@ -716,7 +710,7 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) {
else if (y2 > vs->height)
y2 = vs->height;
- markRectAsDirty(vs->number, x, x2, y, y2, 0);
+ markRectAsDirty(vs->number, x, x2, y, y2);
backbuff = vs->screenPtr + vs->xstart + y * vs->width + x;
diff --git a/scumm/object.cpp b/scumm/object.cpp
index 7cddf18d32..b892dd6589 100644
--- a/scumm/object.cpp
+++ b/scumm/object.cpp
@@ -1515,7 +1515,7 @@ void ScummEngine::drawBlastObject(BlastObject *eo) {
drawBomp(bdd, false);
}
- markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0);
+ markRectAsDirty(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight);
}
void ScummEngine::removeBlastObjects() {
@@ -1566,7 +1566,7 @@ void ScummEngine::removeBlastObject(BlastObject *eo) {
for (i = left_strip; i <= right_strip; i++)
gdi.resetBackground(r.top, r.bottom, i);
- markRectAsDirty(kMainVirtScreen, r.left, r.right, r.top, r.bottom, USAGE_BIT_RESTORED);
+ markRectAsDirty(kMainVirtScreen, r, USAGE_BIT_RESTORED);
}
int ScummEngine::findLocalObjectSlot() {
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 738e08b204..f9cc2775d4 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -853,7 +853,10 @@ protected:
public:
- void markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit);
+ void markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit = 0);
+ void markRectAsDirty(VirtScreenNumber virt, Common::Rect rect, int dirtybit = 0) {
+ markRectAsDirty(virt, rect.left, rect.right, rect.top, rect.bottom, dirtybit);
+ }
protected:
void drawDirtyScreenParts();
void updateDirtyScreen(VirtScreenNumber slot);
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp
index da4bd4890f..6e22fcc561 100644
--- a/scumm/verbs.cpp
+++ b/scumm/verbs.cpp
@@ -137,7 +137,7 @@ void ScummEngine::checkV2MouseOver(Common::Point pos) {
dst += vs->width;
}
- markRectAsDirty(kVerbVirtScreen, rect.left, rect.right, rect.top, rect.bottom, 0);
+ markRectAsDirty(kVerbVirtScreen, rect);
}
if (new_box != -1) {
@@ -154,7 +154,7 @@ void ScummEngine::checkV2MouseOver(Common::Point pos) {
dst += vs->width;
}
- markRectAsDirty(kVerbVirtScreen, rect.left, rect.right, rect.top, rect.bottom, 0);
+ markRectAsDirty(kVerbVirtScreen, rect);
}
v2_mouseover_box = new_box;