[Scummvm-cvs-logs] SF.net SVN: scummvm: [29854] scummvm/trunk/engines/agi

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Thu Dec 13 20:44:27 CET 2007


Revision: 29854
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29854&view=rev
Author:   thebluegr
Date:     2007-12-13 11:44:27 -0800 (Thu, 13 Dec 2007)

Log Message:
-----------
Use CLIP template for clipping in the AGI engine

Modified Paths:
--------------
    scummvm/trunk/engines/agi/picture.cpp
    scummvm/trunk/engines/agi/sprite.cpp

Modified: scummvm/trunk/engines/agi/picture.cpp
===================================================================
--- scummvm/trunk/engines/agi/picture.cpp	2007-12-13 19:07:10 UTC (rev 29853)
+++ scummvm/trunk/engines/agi/picture.cpp	2007-12-13 19:44:27 UTC (rev 29854)
@@ -80,12 +80,10 @@
  * @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);

Modified: scummvm/trunk/engines/agi/sprite.cpp
===================================================================
--- scummvm/trunk/engines/agi/sprite.cpp	2007-12-13 19:07:10 UTC (rev 29853)
+++ scummvm/trunk/engines/agi/sprite.cpp	2007-12-13 19:44:27 UTC (rev 29854)
@@ -708,23 +708,10 @@
 	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);
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list