[Scummvm-cvs-logs] SF.net SVN: scummvm: [32305] scummvm/trunk/engines/gob/driver_vga.cpp
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Mon May 26 23:07:50 CEST 2008
Revision: 32305
http://scummvm.svn.sourceforge.net/scummvm/?rev=32305&view=rev
Author: drmccoy
Date: 2008-05-26 14:07:49 -0700 (Mon, 26 May 2008)
Log Message:
-----------
Use memmove when source and destination sprite areas overlap in drawSprite()
Modified Paths:
--------------
scummvm/trunk/engines/gob/driver_vga.cpp
Modified: scummvm/trunk/engines/gob/driver_vga.cpp
===================================================================
--- scummvm/trunk/engines/gob/driver_vga.cpp 2008-05-26 20:19:56 UTC (rev 32304)
+++ scummvm/trunk/engines/gob/driver_vga.cpp 2008-05-26 21:07:49 UTC (rev 32305)
@@ -109,10 +109,16 @@
int16 width = MIN((right - left) + 1, (int) dest->getWidth());
int16 height = MIN((bottom - top) + 1, (int) dest->getHeight());
+ if ((width < 1) || (height < 1))
+ return;
+
byte *srcPos = source->getVidMem() + (top * source->getWidth()) + left;
byte *destPos = dest->getVidMem() + (y * dest->getWidth()) + x;
+ uint32 size = width * height;
+
if (transp) {
+
while (height--) {
for (int16 i = 0; i < width; ++i) {
if (srcPos[i])
@@ -122,13 +128,26 @@
srcPos += source->getWidth();
destPos += dest->getWidth();
}
+
+ } else if (((srcPos >= destPos) && (srcPos <= (destPos + size))) ||
+ ((destPos >= srcPos) && (destPos <= (srcPos + size)))) {
+
+ while (height--) {
+ memmove(destPos, srcPos, width);
+
+ srcPos += source->getWidth();
+ destPos += dest->getWidth();
+ }
+
} else {
+
while (height--) {
memcpy(destPos, srcPos, width);
srcPos += source->getWidth();
destPos += dest->getWidth();
}
+
}
}
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