[Scummvm-cvs-logs] scummvm master -> 13f93494578818b5a1272d793f7412b6810f3321

lordhoto lordhoto at gmail.com
Tue Jun 12 04:19:49 CEST 2012


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:
0075fa2f98 GRAPHICS: Replace OverlayColor with uint16 in scaler code.
13f9349457 GUI: Take advantage of Surface::fillRect in GraphicsWidget::setGfx.


Commit: 0075fa2f98eb3deb4674a4f1af95a84669098d7c
    https://github.com/scummvm/scummvm/commit/0075fa2f98eb3deb4674a4f1af95a84669098d7c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-11T19:18:59-07:00

Commit Message:
GRAPHICS: Replace OverlayColor with uint16 in scaler code.

Scalers are actually fixed at 2Bpp right now and not at the
depth of OverlayColor.

Changed paths:
    graphics/scaler.cpp
    graphics/scaler/aspect.cpp



diff --git a/graphics/scaler.cpp b/graphics/scaler.cpp
index 9ade0e6..b81e893 100644
--- a/graphics/scaler.cpp
+++ b/graphics/scaler.cpp
@@ -167,12 +167,12 @@ void DestroyScalers(){
 void Normal1x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch,
 							int width, int height) {
 	// Spot the case when it can all be done in 1 hit
-	if ((srcPitch == sizeof(OverlayColor) * (uint)width) && (dstPitch == sizeof(OverlayColor) * (uint)width)) {
-		memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width * height);
+	if ((srcPitch == sizeof(uint16) * (uint)width) && (dstPitch == sizeof(uint16) * (uint)width)) {
+		memcpy(dstPtr, srcPtr, sizeof(uint16) * width * height);
 		return;
 	}
 	while (height--) {
-		memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+		memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 		srcPtr += srcPitch;
 		dstPtr += dstPitch;
 	}
@@ -207,11 +207,10 @@ void Normal2x(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPit
 	uint8 *r;
 
 	assert(IS_ALIGNED(dstPtr, 4));
-	assert(sizeof(OverlayColor) == 2);
 	while (height--) {
 		r = dstPtr;
 		for (int i = 0; i < width; ++i, r += 4) {
-			uint32 color = *(((const OverlayColor *)srcPtr) + i);
+			uint32 color = *(((const uint16 *)srcPtr) + i);
 
 			color |= color << 16;
 
diff --git a/graphics/scaler/aspect.cpp b/graphics/scaler/aspect.cpp
index 7ad37b1..f0ae732 100644
--- a/graphics/scaler/aspect.cpp
+++ b/graphics/scaler/aspect.cpp
@@ -160,14 +160,14 @@ int stretch200To240(uint8 *buf, uint32 pitch, int width, int height, int srcX, i
 #if ASPECT_MODE == kSuperFastAndUglyAspectMode
 		if (srcPtr == dstPtr)
 			break;
-		memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+		memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 #else
 		// Bilinear filter
 		switch (y % 6) {
 		case 0:
 		case 5:
 			if (srcPtr != dstPtr)
-				memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+				memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 			break;
 		case 1:
 			interpolate5Line<ColorMask, 1>((uint16 *)dstPtr, (const uint16 *)(srcPtr - pitch), (const uint16 *)srcPtr, width);
@@ -206,13 +206,13 @@ void Normal1xAspectTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
 #if ASPECT_MODE == kSuperFastAndUglyAspectMode
 		if ((y % 6) == 5)
 			srcPtr -= srcPitch;
-		memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+		memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 #else
 		// Bilinear filter five input lines onto six output lines
 		switch (y % 6) {
 		case 0:
 			// First output line is copied from first input line
-			memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+			memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 			break;
 		case 1:
 			// Second output line is mixed from first and second input line
@@ -233,7 +233,7 @@ void Normal1xAspectTemplate(const uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr,
 		case 5:
 			// Sixth (and last) output line is copied from fifth (and last) input line
 			srcPtr -= srcPitch;
-			memcpy(dstPtr, srcPtr, sizeof(OverlayColor) * width);
+			memcpy(dstPtr, srcPtr, sizeof(uint16) * width);
 			break;
 		}
 #endif


Commit: 13f93494578818b5a1272d793f7412b6810f3321
    https://github.com/scummvm/scummvm/commit/13f93494578818b5a1272d793f7412b6810f3321
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-06-11T19:18:59-07:00

Commit Message:
GUI: Take advantage of Surface::fillRect in GraphicsWidget::setGfx.

Changed paths:
    gui/widget.cpp



diff --git a/gui/widget.cpp b/gui/widget.cpp
index fc6510b..657245c 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -643,14 +643,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) {
 
 	_gfx.free();
 	_gfx.create(w, h, overlayFormat);
-
-	OverlayColor *dst = (OverlayColor *)_gfx.pixels;
-	OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b);
-	while (h--) {
-		for (int i = 0; i < w; ++i) {
-			*dst++ = fillCol;
-		}
-	}
+	_gfx.fillRect(Common::Rect(0, 0, w, h), _gfx.format.RGBToColor(r, g, b));
 }
 
 void GraphicsWidget::drawWidget() {






More information about the Scummvm-git-logs mailing list