aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2007-12-13 19:44:27 +0000
committerFilippos Karapetis2007-12-13 19:44:27 +0000
commit40661e56987299640445d6c25933cd0723794641 (patch)
tree7271c26477c9c76616abba95b8ffc47c9f9f13a2 /engines/agi
parente1b73e47f826ebf96db54567a4fade6e1f1c4484 (diff)
downloadscummvm-rg350-40661e56987299640445d6c25933cd0723794641.tar.gz
scummvm-rg350-40661e56987299640445d6c25933cd0723794641.tar.bz2
scummvm-rg350-40661e56987299640445d6c25933cd0723794641.zip
Use CLIP template for clipping in the AGI engine
svn-id: r29854
Diffstat (limited to 'engines/agi')
-rw-r--r--engines/agi/picture.cpp10
-rw-r--r--engines/agi/sprite.cpp21
2 files changed, 8 insertions, 23 deletions
diff --git a/engines/agi/picture.cpp b/engines/agi/picture.cpp
index 32a2b5c01e..3ada698b79 100644
--- a/engines/agi/picture.cpp
+++ b/engines/agi/picture.cpp
@@ -80,12 +80,10 @@ static void drawProc(int x, int y, int c, void *data) {
* @param y2 y coordinate of end point
*/
void PictureMgr::drawLine(int x1, int y1, int x2, int y2) {
- /* CM: Do clipping */
-#define clip(x, y) if ((x)>=(y)) (x)=(y)
- clip(x1, _width - 1);
- clip(x2, _width - 1);
- clip(y1, _height - 1);
- clip(y2, _height - 1);
+ x1 = CLIP(x1, 0, _width - 1);
+ x2 = CLIP(x2, 0, _width - 1);
+ y1 = CLIP(y1, 0, _height - 1);
+ y2 = CLIP(y2, 0, _height - 1);
#if 0
Graphics::drawLine(x1, y1, x2, y2, 0, drawProc, this);
diff --git a/engines/agi/sprite.cpp b/engines/agi/sprite.cpp
index 006e3dddee..43720703d7 100644
--- a/engines/agi/sprite.cpp
+++ b/engines/agi/sprite.cpp
@@ -708,23 +708,10 @@ void SpritesMgr::commitBlock(int x1, int y1, int x2, int y2) {
if (!_vm->_game.pictureShown)
return;
- /* Clipping */
- if (x1 < 0)
- x1 = 0;
- if (x2 < 0)
- x2 = 0;
- if (y1 < 0)
- y1 = 0;
- if (y2 < 0)
- y2 = 0;
- if (x1 >= _WIDTH)
- x1 = _WIDTH - 1;
- if (x2 >= _WIDTH)
- x2 = _WIDTH - 1;
- if (y1 >= _HEIGHT)
- y1 = _HEIGHT - 1;
- if (y2 >= _HEIGHT)
- y2 = _HEIGHT - 1;
+ x1 = CLIP(x1, 0, _WIDTH - 1);
+ x2 = CLIP(x2, 0, _WIDTH - 1);
+ y1 = CLIP(y1, 0, _HEIGHT - 1);
+ y2 = CLIP(y2, 0, _HEIGHT - 1);
debugC(7, kDebugLevelSprites, "%d, %d, %d, %d", x1, y1, x2, y2);