[Scummvm-cvs-logs] SF.net SVN: scummvm:[52268] scummvm/trunk/graphics/surface.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Sat Aug 21 22:14:47 CEST 2010


Revision: 52268
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52268&view=rev
Author:   sev
Date:     2010-08-21 20:14:46 +0000 (Sat, 21 Aug 2010)

Log Message:
-----------
GRAPHICS: Extend Surface::fill() method to support 32bits. Looks ugly

Modified Paths:
--------------
    scummvm/trunk/graphics/surface.cpp

Modified: scummvm/trunk/graphics/surface.cpp
===================================================================
--- scummvm/trunk/graphics/surface.cpp	2010-08-21 18:16:04 UTC (rev 52267)
+++ scummvm/trunk/graphics/surface.cpp	2010-08-21 20:14:46 UTC (rev 52268)
@@ -143,8 +143,10 @@
 		lineLen *= 2;
 		if ((uint16)color != ((color & 0xff) | (color & 0xff) << 8))
 			useMemset = false;
+	} else if (bytesPerPixel == 4) {
+		useMemset = false;
 	} else if (bytesPerPixel != 1) {
-		error("Surface::fillRect: bytesPerPixel must be 1 or 2");
+		error("Surface::fillRect: bytesPerPixel must be 1, 2 or 4");
 	}
 
 	if (useMemset) {
@@ -154,10 +156,18 @@
 			ptr += pitch;
 		}
 	} else {
-		uint16 *ptr = (uint16 *)getBasePtr(r.left, r.top);
-		while (height--) {
-			Common::set_to(ptr, ptr + width, (uint16)color);
-			ptr += pitch/2;
+		if (bytesPerPixel == 2) {
+			uint16 *ptr = (uint16 *)getBasePtr(r.left, r.top);
+			while (height--) {
+				Common::set_to(ptr, ptr + width, (uint16)color);
+				ptr += pitch/2;
+			}
+		} else {
+			uint32 *ptr = (uint32 *)getBasePtr(r.left, r.top);
+			while (height--) {
+				Common::set_to(ptr, ptr + width, color);
+				ptr += pitch / 4;
+			}
 		}
 	}
 }


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