[Scummvm-cvs-logs] scummvm master -> 5fdf2796d6542db5ae05774bbbe792923c67b68b

clone2727 clone2727 at gmail.com
Fri May 20 01:00:35 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1ee5ef9c6f GRAPHICS: Allow auxiliary surface functions to be used for 32bpp surfaces
5fdf2796d6 GRAPHICS: Cleanup formatting


Commit: 1ee5ef9c6fd335ca00901e32dc3e05ba8474403b
    https://github.com/scummvm/scummvm/commit/1ee5ef9c6fd335ca00901e32dc3e05ba8474403b
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-05-19T15:38:09-07:00

Commit Message:
GRAPHICS: Allow auxiliary surface functions to be used for 32bpp surfaces

Changed paths:
    graphics/surface.cpp



diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 3f53ce5..772ec12 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -42,8 +42,10 @@ void Surface::drawLine(int x0, int y0, int x1, int y1, uint32 color) {
 		Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<byte>, this);
 	else if (format.bytesPerPixel == 2)
 		Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<uint16>, this);
+	else if (format.bytesPerPixel == 4)
+		Graphics::drawLine(x0, y0, x1, y1, color, plotPoint<uint32>, this);
 	else
-		error("Surface::drawLine: bytesPerPixel must be 1 or 2");
+		error("Surface::drawLine: bytesPerPixel must be 1, 2, or 4");
 }
 
 void Surface::create(uint16 width, uint16 height, const PixelFormat &f) {
@@ -92,8 +94,11 @@ void Surface::hLine(int x, int y, int x2, uint32 color) {
 	} else if (format.bytesPerPixel == 2) {
 		uint16 *ptr = (uint16 *)getBasePtr(x, y);
 		Common::set_to(ptr, ptr + (x2-x+1), (uint16)color);
+	} else if (format.bytesPerPixel == 4) {
+		uint32 *ptr = (uint32 *)getBasePtr(x, y);
+		Common::set_to(ptr, ptr + (x2-x+1), color);
 	} else {
-		error("Surface::hLine: bytesPerPixel must be 1 or 2");
+		error("Surface::hLine: bytesPerPixel must be 1, 2, or 4");
 	}
 }
 
@@ -122,8 +127,15 @@ void Surface::vLine(int x, int y, int y2, uint32 color) {
 			*ptr = (uint16)color;
 			ptr += pitch/2;
 		}
+	
+	} else if (format.bytesPerPixel == 4) {
+		uint32 *ptr = (uint32 *)getBasePtr(x, y);
+		while (y++ <= y2) {
+			*ptr = color;
+			ptr += pitch / 4;
+		}
 	} else {
-		error("Surface::vLine: bytesPerPixel must be 1 or 2");
+		error("Surface::vLine: bytesPerPixel must be 1, 2, or 4");
 	}
 }
 
@@ -183,8 +195,8 @@ void Surface::move(int dx, int dy, int height) {
 	if ((dx == 0 && dy == 0) || height <= 0)
 		return;
 
-	if (format.bytesPerPixel != 1 && format.bytesPerPixel != 2)
-		error("Surface::move: bytesPerPixel must be 1 or 2");
+	if (format.bytesPerPixel != 1 && format.bytesPerPixel != 2 && format.bytesPerPixel != 4)
+		error("Surface::move: bytesPerPixel must be 1, 2, or 4");
 
 	byte *src, *dst;
 	int x, y;
@@ -223,6 +235,10 @@ void Surface::move(int dx, int dy, int height) {
 					*(uint16 *)dst = *(const uint16 *)src;
 					src -= 2;
 					dst -= 2;
+				} else if (format.bytesPerPixel == 4) {
+					*(uint32 *)dst = *(const uint32 *)src;
+					src -= 4;
+					dst -= 4;
 				}
 			}
 			src += pitch + (pitch - dx * format.bytesPerPixel);
@@ -240,6 +256,10 @@ void Surface::move(int dx, int dy, int height) {
 					*(uint16 *)dst = *(const uint16 *)src;
 					src += 2;
 					dst += 2;
+				} else if (format.bytesPerPixel == 4) {
+					*(uint32 *)dst = *(const uint32 *)src;
+					src += 4;
+					dst += 4;
 				}
 			}
 			src += pitch - (pitch + dx * format.bytesPerPixel);


Commit: 5fdf2796d6542db5ae05774bbbe792923c67b68b
    https://github.com/scummvm/scummvm/commit/5fdf2796d6542db5ae05774bbbe792923c67b68b
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-05-19T15:38:09-07:00

Commit Message:
GRAPHICS: Cleanup formatting

Changed paths:
    graphics/surface.cpp



diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index 772ec12..cee8e61 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -90,13 +90,13 @@ void Surface::hLine(int x, int y, int x2, uint32 color) {
 
 	if (format.bytesPerPixel == 1) {
 		byte *ptr = (byte *)getBasePtr(x, y);
-		memset(ptr, (byte)color, x2-x+1);
+		memset(ptr, (byte)color, x2 - x + 1);
 	} else if (format.bytesPerPixel == 2) {
 		uint16 *ptr = (uint16 *)getBasePtr(x, y);
-		Common::set_to(ptr, ptr + (x2-x+1), (uint16)color);
+		Common::set_to(ptr, ptr + (x2 - x + 1), (uint16)color);
 	} else if (format.bytesPerPixel == 4) {
 		uint32 *ptr = (uint32 *)getBasePtr(x, y);
-		Common::set_to(ptr, ptr + (x2-x+1), color);
+		Common::set_to(ptr, ptr + (x2 - x + 1), color);
 	} else {
 		error("Surface::hLine: bytesPerPixel must be 1, 2, or 4");
 	}
@@ -125,7 +125,7 @@ void Surface::vLine(int x, int y, int y2, uint32 color) {
 		uint16 *ptr = (uint16 *)getBasePtr(x, y);
 		while (y++ <= y2) {
 			*ptr = (uint16)color;
-			ptr += pitch/2;
+			ptr += pitch / 2;
 		}
 	
 	} else if (format.bytesPerPixel == 4) {
@@ -157,7 +157,7 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
 	} else if (format.bytesPerPixel == 4) {
 		useMemset = false;
 	} else if (format.bytesPerPixel != 1) {
-		error("Surface::fillRect: bytesPerPixel must be 1, 2 or 4");
+		error("Surface::fillRect: bytesPerPixel must be 1, 2, or 4");
 	}
 
 	if (useMemset) {
@@ -171,7 +171,7 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
 			uint16 *ptr = (uint16 *)getBasePtr(r.left, r.top);
 			while (height--) {
 				Common::set_to(ptr, ptr + width, (uint16)color);
-				ptr += pitch/2;
+				ptr += pitch / 2;
 			}
 		} else {
 			uint32 *ptr = (uint32 *)getBasePtr(r.left, r.top);
@@ -184,10 +184,10 @@ void Surface::fillRect(Common::Rect r, uint32 color) {
 }
 
 void Surface::frameRect(const Common::Rect &r, uint32 color) {
-	hLine(r.left, r.top, r.right-1, color);
-	hLine(r.left, r.bottom-1, r.right-1, color);
-	vLine(r.left, r.top, r.bottom-1, color);
-	vLine(r.right-1, r.top, r.bottom-1, color);
+	hLine(r.left, r.top, r.right - 1, color);
+	hLine(r.left, r.bottom - 1, r.right - 1, color);
+	vLine(r.left, r.top, r.bottom - 1, color);
+	vLine(r.right - 1, r.top, r.bottom - 1, color);
 }
 
 void Surface::move(int dx, int dy, int height) {






More information about the Scummvm-git-logs mailing list