[Scummvm-cvs-logs] SF.net SVN: scummvm:[34491] scummvm/trunk/engines/drascula/graphics.cpp
thebluegr at users.sourceforge.net
thebluegr at users.sourceforge.net
Thu Sep 11 14:04:45 CEST 2008
Revision: 34491
http://scummvm.svn.sourceforge.net/scummvm/?rev=34491&view=rev
Author: thebluegr
Date: 2008-09-11 12:04:45 +0000 (Thu, 11 Sep 2008)
Log Message:
-----------
Code optimizations from Fingolfin
Modified Paths:
--------------
scummvm/trunk/engines/drascula/graphics.cpp
Modified: scummvm/trunk/engines/drascula/graphics.cpp
===================================================================
--- scummvm/trunk/engines/drascula/graphics.cpp 2008-09-11 09:37:42 UTC (rev 34490)
+++ scummvm/trunk/engines/drascula/graphics.cpp 2008-09-11 12:04:45 UTC (rev 34491)
@@ -167,8 +167,18 @@
int height, byte *src, byte *dest) {
dest += xdes + ydes * 320;
src += xorg + yorg * 320;
+ /* Unoptimized code
for (int x = 0; x < height; x++) {
memcpy(dest + 320 * x, src + 320 * x, width);
+ } */
+
+ // A bit more optimized code, thanks to Fingolfin
+ // Uses 2 less registers and performs 2 less multiplications
+ int x = height;
+ while (x--) {
+ memcpy(dest, src, width);
+ dest += 320;
+ src += 320;
}
}
@@ -223,8 +233,19 @@
ptr += xdes + ydes * 320;
buffer += xorg + yorg * 320;
+
+ /* Unoptimized code
for (int x = 0; x < height; x++) {
memcpy(ptr + 320 * x, buffer + 320 * x, width);
+ } */
+
+ // A bit more optimized code, thanks to Fingolfin
+ // Uses 2 less registers and performs 2 less multiplications
+ int x = height;
+ while (x--) {
+ memcpy(ptr, buffer, width);
+ ptr += 320;
+ buffer += 320;
}
_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
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