[Scummvm-cvs-logs] CVS: scummvm/scumm gfx.cpp,2.347,2.348 akos.cpp,1.184,1.185
Max Horn
fingolfin at users.sourceforge.net
Mon Sep 27 16:17:03 CEST 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4316
Modified Files:
gfx.cpp akos.cpp
Log Message:
Well, it *looks* as if that clipping code could be simplified. We'll see if somebody starts to yell about the changes, though :-)
Index: gfx.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/gfx.cpp,v
retrieving revision 2.347
retrieving revision 2.348
diff -u -d -r2.347 -r2.348
--- gfx.cpp 27 Sep 2004 22:29:35 -0000 2.347
+++ gfx.cpp 27 Sep 2004 23:10:15 -0000 2.348
@@ -1459,7 +1459,6 @@
srcRect = Common::Rect(0, 0, src_w - 1, src_h - 1);
dstRect = Common::Rect(src_x, src_y, src_x + src_w - 1, src_y + src_h - 1);
Common::Rect r3;
- int diff;
if (rect) {
r3 = *rect;
@@ -1472,31 +1471,9 @@
} else {
r3 = Common::Rect(0, 0, dst_w - 1, dst_h - 1);
}
- diff = dstRect.left - r3.left;
- if (diff < 0) {
- srcRect.left -= diff;
- dstRect.left -= diff;
- }
- diff = dstRect.right - r3.right;
- if (diff > 0) {
- srcRect.right -= diff;
- dstRect.right -= diff;
- }
- diff = dstRect.top - r3.top;
- if (diff < 0) {
- srcRect.top -= diff;
- dstRect.top -= diff;
- }
- diff = dstRect.bottom - r3.bottom;
- if (diff > 0) {
- srcRect.bottom -= diff;
- dstRect.bottom -= diff;
- }
- // TODO/FIXME: At this point, unless I am mistaken, srcRect == dstRect.moveTo(0, 0)
- // As such the code above could be simplified (i.e. srcRect could be removed,
- // and then the uses of the diff variables can be folded in).
- // In fact it looks to me as if the code above just does some simple clipping...
- // Since I don't have the HE games in questions, I can't test this, though.
+ dstRect.clip(r3);
+ srcRect = dstRect;
+ srcRect.moveTo(0, 0);
return true;
}
Index: akos.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/akos.cpp,v
retrieving revision 1.184
retrieving revision 1.185
diff -u -d -r1.184 -r1.185
--- akos.cpp 27 Sep 2004 21:46:25 -0000 1.184
+++ akos.cpp 27 Sep 2004 23:10:19 -0000 1.185
@@ -1218,35 +1218,13 @@
dst.left = _actorX + xmoveCur;
}
- src.top = src.left = 0;
- src.right = _width - 1;
- src.bottom = _height - 1;
-
dst.top = _actorY + ymoveCur;
dst.right = dst.left + _width - 1;
dst.bottom = dst.top + _height - 1;
- int diff;
- diff = dst.left - _clipOverride.left;
- if (diff < 0) {
- src.left -= diff;
- dst.left -= diff;
- }
- diff = dst.right - _clipOverride.right;
- if (diff > 0) {
- src.right -= diff;
- dst.right -= diff;
- }
- diff = dst.top - _clipOverride.top;
- if (diff < 0) {
- src.top -= diff;
- dst.top -= diff;
- }
- diff = dst.bottom - _clipOverride.bottom;
- if (diff > 0) {
- src.bottom -= diff;
- dst.bottom -= diff;
- }
+ dst.clip(_clipOverride);
+ src = dst;
+ src.moveTo(0, 0);
_vm->markRectAsDirty(kMainVirtScreen, dst);
More information about the Scummvm-git-logs
mailing list