[Scummvm-cvs-logs] SF.net SVN: scummvm:[51290] scummvm/branches/gsoc2010-opengl/backends/ graphics/opengl/opengl-graphics.cpp

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Mon Jul 26 04:16:11 CEST 2010


Revision: 51290
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51290&view=rev
Author:   vgvgf
Date:     2010-07-26 02:16:10 +0000 (Mon, 26 Jul 2010)

Log Message:
-----------
OPENGL: Fixed alpha problem with overlay RGBA5551 format.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-26 00:41:31 UTC (rev 51289)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-07-26 02:16:10 UTC (rev 51290)
@@ -485,13 +485,26 @@
 	if (w <= 0 || h <= 0)
 		return;
 
-	// Copy buffer data to internal overlay surface
-	const byte *src = (byte *)buf;
-	byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
-	for (int i = 0; i < h; i++) {
-		memcpy(dst + x * _overlayData.bytesPerPixel, src, w * _overlayData.bytesPerPixel);
-		src += pitch * sizeof(buf[0]);
-		dst += _overlayData.pitch;
+	if (_overlayFormat.aBits() == 1) {
+		// Copy buffer with the alpha bit on for all pixels for correct
+		// overlay drawing.
+		const uint16 *src = (uint16 *)buf;
+		uint16 *dst = (uint16 *)_overlayData.pixels + y * _overlayData.w + x;
+		for (int i = 0; i < h; i++) {
+			for (int e = 0; e < w; e++)
+				dst[e] = src[e] | 0x1;
+			src += pitch;
+			dst += _overlayData.w;
+		}
+	} else {
+		// Copy buffer data to internal overlay surface
+		const byte *src = (byte *)buf;
+		byte *dst = (byte *)_overlayData.pixels + y * _overlayData.pitch;
+		for (int i = 0; i < h; i++) {
+			memcpy(dst + x * _overlayData.bytesPerPixel, src, w * _overlayData.bytesPerPixel);
+			src += pitch * sizeof(buf[0]);
+			dst += _overlayData.pitch;
+		}
 	}
 
 	if (!_overlayNeedsRedraw) {


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