[Scummvm-cvs-logs] SF.net SVN: scummvm:[53272] scummvm/trunk/engines/sword25/gfx/opengl

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:11:41 CEST 2010


Revision: 53272
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53272&view=rev
Author:   sev
Date:     2010-10-12 23:11:41 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Attempt to implement alpha blending. Code disabled.

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp

Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:11:18 UTC (rev 53271)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:11:41 UTC (rev 53272)
@@ -209,33 +209,37 @@
 	byte *ino = &_data[y1 * m_Width * 4 + x1 * 4];
 	byte *outo = (byte *)_backSurface->getBasePtr(PosX, PosY);
 	byte *in, *out;
-	bool alphawarn = false;
 
 	for (int i = 0; i < h; i++) {
 		out = outo;
 		in = ino;
 		for (int j = 0; j < w; j++) {
-			if (*in == 0) {
+			switch (*in) {
+			case 0: // Full transparency
 				in += 4;
 				out += 4;
-				continue;
+				break;
+			case 255: // Full opacity
+			default:
+				*out++ = *in++;
+				*out++ = *in++;
+				*out++ = *in++;
+				*out++ = *in++;
+				break;
+#if 0
+			default: // alpha blending
+				*out++ = 255;
+				int alpha = *in++;
+				for (int c = 0; c < 3; c++, out++, in++) {
+					*out = (byte)((int)(*out - *in) * alpha + *in);
+				}
+#endif
 			}
-
-			if (*in != 255)
-				alphawarn = true;
-
-			*out++ = *in++; // TODO: alpha blending
-			*out++ = *in++;
-			*out++ = *in++;
-			*out++ = *in++;
 		}
 		outo += _backSurface->pitch;
 		ino += m_Width * 4;
 	}
 
-	if (alphawarn)
-		warning("STUB: alpha image");
-
 	g_system->copyRectToScreen((byte *)_backSurface->getBasePtr(PosX, PosY), _backSurface->pitch, PosX, PosY, w, h);
 
 	return true;

Modified: scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:11:18 UTC (rev 53271)
+++ scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:11:41 UTC (rev 53272)
@@ -213,18 +213,14 @@
 // -----------------------------------------------------------------------------
 
 bool OpenGLGfx::Fill(const Common::Rect *fillRectPtr, unsigned int color) {
-	Common::Rect rect;
+	Common::Rect rect(m_Width - 1, m_Height - 1);
 
-	if (!fillRectPtr) {
-		rect.left = 0;
-		rect.top = 0;
-		rect.right = m_Width - 1;
-		rect.bottom = m_Height - 1;
-		fillRectPtr = ▭
+	if (fillRectPtr) {
+		rect = *fillRectPtr;
 	}
 
 	if (fillRectPtr->width() > 0 && fillRectPtr->height() > 0) {
-		_backSurface.fillRect(*fillRectPtr, color);
+		_backSurface.fillRect(rect, color);
 		g_system->copyRectToScreen((byte *)_backSurface.getBasePtr(fillRectPtr->left, fillRectPtr->top), _backSurface.pitch, fillRectPtr->left, fillRectPtr->top, fillRectPtr->width(), fillRectPtr->height());
 	}
 


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