[PATCH 4/5] wined3d: Use the same flags for wined3d_texture_set_color_key() and the "color_key_flags" field it sets.

Henri Verbeet hverbeet at codeweavers.com
Mon Jan 19 06:44:11 CST 2015


This fixes a regression introduced by commit
a8ab56941577a01e17b947cddd374ba52ffd8245.
---
 dlls/wined3d/device.c  |    2 +-
 dlls/wined3d/state.c   |    4 ++--
 dlls/wined3d/surface.c |   14 +++++++-------
 dlls/wined3d/texture.c |   42 +++++++++++++++++++++---------------------
 dlls/wined3d/utils.c   |    4 ++--
 include/wine/wined3d.h |   35 ++++++-----------------------------
 6 files changed, 39 insertions(+), 62 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1156a7e..29ce04f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -616,7 +616,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
 
         color_key.color_space_low_value = 0;
         color_key.color_space_high_value = 0;
-        wined3d_texture_set_color_key(device->logo_texture, WINEDDCKEY_SRCBLT, &color_key);
+        wined3d_texture_set_color_key(device->logo_texture, WINED3D_CKEY_SRC_BLT, &color_key);
     }
     else
     {
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 14de5dd..2b149a0 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -535,7 +535,7 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st
      * WINED3D_RS_COLORKEYENABLE state(which is d3d <= 3 only). The texture
      * function will call alpha in case it finds some texture + colorkeyenable
      * combination which needs extra care. */
-    if (state->textures[0] && (state->textures[0]->color_key_flags & WINEDDSD_CKSRCBLT))
+    if (state->textures[0] && (state->textures[0]->color_key_flags & WINED3D_CKEY_SRC_BLT))
         enable_ckey = TRUE;
 
     if (enable_ckey || context->last_was_ckey)
@@ -3214,7 +3214,7 @@ void tex_alphaop(struct wined3d_context *context, const struct wined3d_state *st
 
         if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
         {
-            if (texture->color_key_flags & WINEDDSD_CKSRCBLT && !texture->resource.format->alpha_size)
+            if (texture->color_key_flags & WINED3D_CKEY_SRC_BLT && !texture->resource.format->alpha_size)
             {
                 /* Color keying needs to pass alpha values from the texture through to have the alpha test work
                  * properly. On the other hand applications can still use texture combiners apparently. This code
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 4249322..6b73fa8 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1821,11 +1821,11 @@ void surface_load(struct wined3d_surface *surface, BOOL srgb)
     if (surface->resource.pool == WINED3D_POOL_SCRATCH)
         ERR("Not supported on scratch surfaces.\n");
 
-    ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->container->color_key_flags & WINEDDSD_CKSRCBLT);
+    ck_changed = !(surface->flags & SFLAG_GLCKEY) != !(surface->container->color_key_flags & WINED3D_CKEY_SRC_BLT);
 
     /* Reload if either the texture and sysmem have different ideas about the
      * color key, or the actual key values changed. */
-    if (ck_changed || ((surface->container->color_key_flags & WINEDDSD_CKSRCBLT)
+    if (ck_changed || ((surface->container->color_key_flags & WINED3D_CKEY_SRC_BLT)
             && (surface->gl_color_key.color_space_low_value
             != surface->container->src_blt_color_key.color_space_low_value
             || surface->gl_color_key.color_space_high_value
@@ -3685,12 +3685,12 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
         else if (flags & WINEDDBLT_KEYSRCOVERRIDE)
         {
             /* Use color key from DDBltFx */
-            wined3d_texture_set_color_key(src_surface->container, WINEDDSD_CKSRCBLT, &DDBltFx->ddckSrcColorkey);
+            wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, &DDBltFx->ddckSrcColorkey);
         }
         else
         {
             /* Do not use color key */
-            wined3d_texture_set_color_key(src_surface->container, WINEDDSD_CKSRCBLT, NULL);
+            wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT, NULL);
         }
 
         surface_blt_to_drawable(device, filter,
@@ -3698,8 +3698,8 @@ static HRESULT surface_blt_special(struct wined3d_surface *dst_surface, const RE
                 src_surface, src_rect, dst_surface, dst_rect);
 
         /* Restore the color key parameters */
-        wined3d_texture_set_color_key(src_surface->container, WINEDDSD_CKSRCBLT,
-                (old_color_key_flags & WINEDDSD_CKSRCBLT) ? &old_blt_key : NULL);
+        wined3d_texture_set_color_key(src_surface->container, WINED3D_CKEY_SRC_BLT,
+                (old_color_key_flags & WINED3D_CKEY_SRC_BLT) ? &old_blt_key : NULL);
 
         surface_validate_location(dst_surface, dst_surface->container->resource.draw_binding);
         surface_invalidate_location(dst_surface, ~dst_surface->container->resource.draw_binding);
@@ -4178,7 +4178,7 @@ static HRESULT surface_load_texture(struct wined3d_surface *surface,
     wined3d_texture_prepare_texture(texture, context, srgb);
     wined3d_texture_bind_and_dirtify(texture, context, srgb);
 
-    if (texture->color_key_flags & WINEDDSD_CKSRCBLT)
+    if (texture->color_key_flags & WINED3D_CKEY_SRC_BLT)
     {
         surface->flags |= SFLAG_GLCKEY;
         surface->gl_color_key = texture->src_blt_color_key;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index f63f84b..9138470 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -557,7 +557,7 @@ HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture,
 {
     TRACE("texture %p, flags %#x, color_key %p.\n", texture, flags, color_key);
 
-    if (flags & WINEDDCKEY_COLORSPACE)
+    if (flags & WINED3D_CKEY_COLORSPACE)
     {
         FIXME("Unhandled flags %#x.\n", flags);
         return WINED3DERR_INVALIDCALL;
@@ -565,47 +565,47 @@ HRESULT CDECL wined3d_texture_set_color_key(struct wined3d_texture *texture,
 
     if (color_key)
     {
-        switch (flags & ~WINEDDCKEY_COLORSPACE)
+        switch (flags & ~WINED3D_CKEY_COLORSPACE)
         {
-            case WINEDDCKEY_DESTBLT:
+            case WINED3D_CKEY_DST_BLT:
                 texture->dst_blt_color_key = *color_key;
-                texture->color_key_flags |= WINEDDSD_CKDESTBLT;
+                texture->color_key_flags |= WINED3D_CKEY_DST_BLT;
                 break;
 
-            case WINEDDCKEY_DESTOVERLAY:
+            case WINED3D_CKEY_DST_OVERLAY:
                 texture->dst_overlay_color_key = *color_key;
-                texture->color_key_flags |= WINEDDSD_CKDESTOVERLAY;
+                texture->color_key_flags |= WINED3D_CKEY_DST_OVERLAY;
                 break;
 
-            case WINEDDCKEY_SRCOVERLAY:
-                texture->src_overlay_color_key = *color_key;
-                texture->color_key_flags |= WINEDDSD_CKSRCOVERLAY;
+            case WINED3D_CKEY_SRC_BLT:
+                texture->src_blt_color_key = *color_key;
+                texture->color_key_flags |= WINED3D_CKEY_SRC_BLT;
                 break;
 
-            case WINEDDCKEY_SRCBLT:
-                texture->src_blt_color_key = *color_key;
-                texture->color_key_flags |= WINEDDSD_CKSRCBLT;
+            case WINED3D_CKEY_SRC_OVERLAY:
+                texture->src_overlay_color_key = *color_key;
+                texture->color_key_flags |= WINED3D_CKEY_SRC_OVERLAY;
                 break;
         }
     }
     else
     {
-        switch (flags & ~WINEDDCKEY_COLORSPACE)
+        switch (flags & ~WINED3D_CKEY_COLORSPACE)
         {
-            case WINEDDCKEY_DESTBLT:
-                texture->color_key_flags &= ~WINEDDSD_CKDESTBLT;
+            case WINED3D_CKEY_DST_BLT:
+                texture->color_key_flags &= ~WINED3D_CKEY_DST_BLT;
                 break;
 
-            case WINEDDCKEY_DESTOVERLAY:
-                texture->color_key_flags &= ~WINEDDSD_CKDESTOVERLAY;
+            case WINED3D_CKEY_DST_OVERLAY:
+                texture->color_key_flags &= ~WINED3D_CKEY_DST_OVERLAY;
                 break;
 
-            case WINEDDCKEY_SRCOVERLAY:
-                texture->color_key_flags &= ~WINEDDSD_CKSRCOVERLAY;
+            case WINED3D_CKEY_SRC_BLT:
+                texture->color_key_flags &= ~WINED3D_CKEY_SRC_BLT;
                 break;
 
-            case WINEDDCKEY_SRCBLT:
-                texture->color_key_flags &= ~WINEDDSD_CKSRCBLT;
+            case WINED3D_CKEY_SRC_OVERLAY:
+                texture->color_key_flags &= ~WINED3D_CKEY_SRC_OVERLAY;
                 break;
         }
     }
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 688cf90d..9e9fc49 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -795,7 +795,7 @@ const struct wined3d_color_key_conversion * wined3d_format_get_color_key_convers
         WINED3DFMT_B8G8R8A8_UNORM,  convert_p8_uint_b8g8r8a8_unorm
     };
 
-    if (need_alpha_ck && (texture->color_key_flags & WINEDDSD_CKSRCBLT))
+    if (need_alpha_ck && (texture->color_key_flags & WINED3D_CKEY_SRC_BLT))
     {
         for (i = 0; i < sizeof(color_key_info) / sizeof(*color_key_info); ++i)
         {
@@ -3527,7 +3527,7 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
 
             if (texture_dimensions == GL_TEXTURE_2D || texture_dimensions == GL_TEXTURE_RECTANGLE_ARB)
             {
-                if (texture->color_key_flags & WINEDDSD_CKSRCBLT && !texture->resource.format->alpha_size)
+                if (texture->color_key_flags & WINED3D_CKEY_SRC_BLT && !texture->resource.format->alpha_size)
                 {
                     if (aop == WINED3D_TOP_DISABLE)
                     {
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index cdb5dc2..987e19e 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1246,6 +1246,12 @@ enum wined3d_display_rotation
 
 #define WINED3D_RESZ_CODE                                       0x7fa05000
 
+#define WINED3D_CKEY_COLORSPACE                                 0x00000001
+#define WINED3D_CKEY_DST_BLT                                    0x00000002
+#define WINED3D_CKEY_DST_OVERLAY                                0x00000004
+#define WINED3D_CKEY_SRC_BLT                                    0x00000008
+#define WINED3D_CKEY_SRC_OVERLAY                                0x00000010
+
 /* dwDDFX */
 /* arithmetic stretching along y axis */
 #define WINEDDBLTFX_ARITHSTRETCHY                               0x00000001
@@ -1296,35 +1302,6 @@ enum wined3d_display_rotation
 #define WINEDDBLT_DONOTWAIT                                     0x08000000
 #define WINEDDBLT_ALPHATEST                                     0x80000000
 
-/* DDSURFACEDESC.dwFlags */
-#define WINEDDSD_CAPS                                           0x00000001
-#define WINEDDSD_HEIGHT                                         0x00000002
-#define WINEDDSD_WIDTH                                          0x00000004
-#define WINEDDSD_PITCH                                          0x00000008
-#define WINEDDSD_BACKBUFFERCOUNT                                0x00000020
-#define WINEDDSD_ZBUFFERBITDEPTH                                0x00000040
-#define WINEDDSD_ALPHABITDEPTH                                  0x00000080
-#define WINEDDSD_LPSURFACE                                      0x00000800
-#define WINEDDSD_PIXELFORMAT                                    0x00001000
-#define WINEDDSD_CKDESTOVERLAY                                  0x00002000
-#define WINEDDSD_CKDESTBLT                                      0x00004000
-#define WINEDDSD_CKSRCOVERLAY                                   0x00008000
-#define WINEDDSD_CKSRCBLT                                       0x00010000
-#define WINEDDSD_MIPMAPCOUNT                                    0x00020000
-#define WINEDDSD_REFRESHRATE                                    0x00040000
-#define WINEDDSD_LINEARSIZE                                     0x00080000
-#define WINEDDSD_TEXTURESTAGE                                   0x00100000
-#define WINEDDSD_FVF                                            0x00200000
-#define WINEDDSD_SRCVBHANDLE                                    0x00400000
-#define WINEDDSD_ALL                                            0x007ff9ee
-
-/* Set/Get Colour Key Flags */
-#define WINEDDCKEY_COLORSPACE                                   0x00000001 /* Struct is single colour space */
-#define WINEDDCKEY_DESTBLT                                      0x00000002 /* To be used as dest for blt */
-#define WINEDDCKEY_DESTOVERLAY                                  0x00000004 /* To be used as dest for CK overlays */
-#define WINEDDCKEY_SRCBLT                                       0x00000008 /* To be used as src for blt */
-#define WINEDDCKEY_SRCOVERLAY                                   0x00000010 /* To be used as src for CK overlays */
-
 /* dwFlags for GetBltStatus */
 #define WINEDDGBS_CANBLT                                        0x00000001
 #define WINEDDGBS_ISBLTDONE                                     0x00000002
-- 
1.7.10.4




More information about the wine-patches mailing list