[D3D] Fix the Blt overide for DEPTH_FILL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes another graphic corruption in DungeonSiege which starts too look
pretty nice...

Changelog:
 - convert the Blt color (which is in frame buffer format) to ARGB

-- 
		 Lionel Ulmer - http://www.bbrox.org/
--- dlls/ddraw_CVS/d3ddevice/mesa.c	Wed May 21 22:50:31 2003
+++ dlls/ddraw/d3ddevice/mesa.c	Thu May 22 00:26:42 2003
@@ -2503,8 +2503,44 @@
 {
     if (dwFlags & DDBLT_COLORFILL) {
         /* This is easy to handle for the D3D Device... */
-        DWORD color = lpbltfx->u5.dwFillColor;
+        DWORD color;
 	D3DRECT rect;
+
+	/* The color as given in the Blt function is in the format of the frame-buffer...
+	 * 'clear' expect it in ARGB format => we need to do some conversion :-)
+	 */
+	if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) {
+	    if (This->palette) {
+	        color |= ((This->palette->palents[lpbltfx->u5.dwFillColor].peRed << 16) |
+			  (This->palette->palents[lpbltfx->u5.dwFillColor].peGreen << 8) |
+			  (This->palette->palents[lpbltfx->u5.dwFillColor].peBlue));
+	    } else {
+	        color = 0xFF000000;
+	    }
+	} else if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_RGB) {
+	    if ((This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount == 16) &&
+		(This->surface_desc.u4.ddpfPixelFormat.u2.dwRBitMask ==        0xF800) &&
+		(This->surface_desc.u4.ddpfPixelFormat.u3.dwGBitMask ==        0x07E0) &&
+		(This->surface_desc.u4.ddpfPixelFormat.u4.dwBBitMask ==        0x001F) &&
+		(This->surface_desc.u4.ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x0000)) {
+	        if (lpbltfx->u5.dwFillColor == 0xFFFF) {
+		    color = 0xFFFFFFFF;
+		} else {
+		    color = ((0xFF000000) |
+			     ((lpbltfx->u5.dwFillColor & 0xF800) << 8) |
+			     ((lpbltfx->u5.dwFillColor & 0x07E0) << 5) |
+			     ((lpbltfx->u5.dwFillColor & 0x001F) << 3));
+		}
+	    } else if ((This->surface_desc.u4.ddpfPixelFormat.u1.dwRGBBitCount == 32) &&
+		       (This->surface_desc.u4.ddpfPixelFormat.u2.dwRBitMask ==        0x00FF0000) &&
+		       (This->surface_desc.u4.ddpfPixelFormat.u3.dwGBitMask ==        0x0000FF00) &&
+		       (This->surface_desc.u4.ddpfPixelFormat.u4.dwBBitMask ==        0x000000FF) &&
+		       (This->surface_desc.u4.ddpfPixelFormat.u5.dwRGBAlphaBitMask == 0x00000000)) {
+	        color = 0xFF000000 | lpbltfx->u5.dwFillColor;
+	    }
+	} else {
+	    ERR("Wrong surface type for BLT override !\n");
+	}
 	
         TRACE(" executing D3D Device override.\n");
 

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux