mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
Use CLIP template for clipping in the AGI engine
svn-id: r29854
This commit is contained in:
parent
e1b73e47f8
commit
40661e5698
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user