[Scummvm-cvs-logs] CVS: scummvm/graphics surface.cpp,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Thu Nov 25 15:53:10 CET 2004


Update of /cvsroot/scummvm/scummvm/graphics
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29354

Modified Files:
	surface.cpp 
Log Message:
Small optimization

Index: surface.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/graphics/surface.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- surface.cpp	25 Nov 2004 23:33:21 -0000	1.1
+++ surface.cpp	25 Nov 2004 23:51:58 -0000	1.2
@@ -39,9 +39,8 @@
 	
 	if (bytesPerPixel == 1) {
 		byte *ptr = (byte *)getBasePtr(x, y);
-		while (x++ <= x2) {
-			*ptr++ = (byte)color;
-		}
+		if (x2 >= x)
+			memset(ptr, (byte)color, x2-x+1);
 	} else if (bytesPerPixel == 2) {
 		uint16 *ptr = (uint16 *)getBasePtr(x, y);
 		while (x++ <= x2) {
@@ -96,9 +95,7 @@
 	if (bytesPerPixel == 1) {
 		byte *ptr = (byte *)getBasePtr(r.left, r.top);
 		while (height--) {
-			for (i = 0; i < width; i++) {
-				ptr[i] = (byte)color;
-			}
+			memset(ptr, (byte)color, width);
 			ptr += pitch;
 		}
 	} else if (bytesPerPixel == 2) {





More information about the Scummvm-git-logs mailing list