WineD3D: No color keying on surfaces with an alpha channel

Stefan Dösinger stefan at codeweavers.com
Thu Oct 5 14:31:50 CDT 2006


An nvidia document mentiones that the their windows driver emulates color 
keying in the same way we do, and that they disable color keys on surfaces 
with an alpha channel. Alpha color keys were always disabled in wined3d, so I 
think we should take the code out.
-------------- next part --------------
From e747aeb1c089ae971c02860ce86d38be7bf2ce9e Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Thu, 5 Oct 2006 21:16:20 +0200
Subject: [PATCH] WineD3D: No color keying on surfaces with an alpha channel
---
 dlls/wined3d/surface.c |   65 +-----------------------------------------------
 1 files changed, 2 insertions(+), 63 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 5e1dad5..b3a8e98 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1572,34 +1572,7 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceI
                 *type = GL_UNSIGNED_INT_8_8_8_8;
             }
             break;
-#if 0
-        /* Not sure if we should do color keying on Alpha-Enabled surfaces */
-        case WINED3DFMT_A4R4G4B4:
-            if (colorkey_active)
-            {
-                *convert = CONVERT_CK_4444_ARGB;
-                *format = GL_RGBA;
-                *internal = GL_RGBA;
-                *type = GL_UNSIGNED_SHORT_4_4_4_4;
-            }
-            break;
 
-        case WINED3DFMT_A1R5G5B5:
-            if (colorkey_active)
-            {
-                *convert = CONVERT_CK_1555;
-            }
-
-        case WINED3DFMT_A8R8G8B8:
-            if (colorkey_active)
-            {
-                *convert = CONVERT_CK_8888_ARGB;
-                *format = GL_RGBA;
-                *internal = GL_RGBA;
-                *type = GL_UNSIGNED_INT_8_8_8_8;
-            }
-            break;
-#endif
         default:
             break;
     }
@@ -1687,8 +1660,8 @@ HRESULT d3dfmt_convert_surface(BYTE *src
                       prevent 'color bleeding'. This will be done later on if ever it is
                       too visible.
 
-              Note2: when using color-keying + alpha, are the alpha bits part of the
-                      color-space or not ?
+              Note2: Nvidia documents say that their driver does not support alpha + color keying
+                     on the same surface and disables color keying in such a case
             */
             unsigned int x;
             WORD *Source = (WORD *) src;
@@ -1708,40 +1681,6 @@ HRESULT d3dfmt_convert_surface(BYTE *src
         }
         break;
 
-        case CONVERT_CK_1555:
-        {
-            unsigned int x;
-            WORD *Source = (WORD *) src;
-            WORD *Dest = (WORD *) dst;
-
-            for (x = 0; x < len * sizeof(WORD); x+=sizeof(WORD)) {
-                WORD color = *Source++;
-                *Dest = (color & 0x7FFF);
-                if ((color < surf->SrcBltCKey.dwColorSpaceLowValue) ||
-                    (color > surf->SrcBltCKey.dwColorSpaceHighValue))
-                    *Dest |= (color & 0x8000);
-                Dest++;
-            }
-        }
-        break;
-
-        case CONVERT_CK_4444_ARGB:
-        {
-            /* Move the four Alpha bits... */
-            unsigned int x;
-            WORD *Source = (WORD *) src;
-            WORD *Dest = (WORD *) dst;
-
-            for (x = 0; x < len; x++) {
-                WORD color = *Source++;
-                *dst = (color & 0x0FFF) << 4;
-                if ((color < surf->SrcBltCKey.dwColorSpaceLowValue) ||
-                    (color > surf->SrcBltCKey.dwColorSpaceHighValue))
-                    *Dest |= (color & 0xF000) >> 12;
-                Dest++;
-            }
-        } break;
-
         default:
             ERR("Unsupported conversation type %d\n", convert);
     }
-- 
1.4.1.1



More information about the wine-patches mailing list