Henri Verbeet : wined3d: Support color keyed WINED3DFMT_B8G8R8A8_UNORM surfaces.
Alexandre Julliard
julliard at winehq.org
Wed Feb 29 14:07:39 CST 2012
Module: wine
Branch: master
Commit: 9c2575865625360b12b74360a0652199b299934f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9c2575865625360b12b74360a0652199b299934f
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Tue Feb 28 19:48:40 2012 +0100
wined3d: Support color keyed WINED3DFMT_B8G8R8A8_UNORM surfaces.
Color keying and alpha channels aren't mutually exclusive.
---
dlls/wined3d/state.c | 7 +------
dlls/wined3d/surface.c | 28 ++++++++++++++++++++++++++++
dlls/wined3d/wined3d_private.h | 1 +
3 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 6974321..a5d748a 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -538,12 +538,7 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st
struct wined3d_surface *surf = surface_from_resource(texture->sub_resources[0]);
if (surf->CKeyFlags & WINEDDSD_CKSRCBLT)
- {
- /* The surface conversion does not do color keying conversion for surfaces that have an alpha
- * channel on their own. Likewise, the alpha test shouldn't be set up for color keying if the
- * surface has alpha bits */
- if (!surf->resource.format->alpha_mask) enable_ckey = TRUE;
- }
+ enable_ckey = TRUE;
}
}
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d293940..9ec3db3 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4554,6 +4554,14 @@ HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_alpha_c
}
break;
+ case WINED3DFMT_B8G8R8A8_UNORM:
+ if (colorkey_active)
+ {
+ *conversion_type = WINED3D_CT_CK_ARGB32;
+ format->conv_byte_count = 4;
+ }
+ break;
+
default:
break;
}
@@ -4765,6 +4773,26 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
}
break;
+ case WINED3D_CT_CK_ARGB32:
+ {
+ unsigned int x, y;
+ for (y = 0; y < height; ++y)
+ {
+ source = src + pitch * y;
+ dest = dst + outpitch * y;
+ for (x = 0; x < width; ++x)
+ {
+ DWORD color = *(const DWORD *)source;
+ if (color_in_range(&surface->src_blt_color_key, color))
+ color &= ~0xff000000;
+ *(DWORD*)dest = color;
+ source += 4;
+ dest += 4;
+ }
+ }
+ }
+ break;
+
default:
ERR("Unsupported conversion type %#x.\n", conversion_type);
}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index df817af..cd9690c 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2192,6 +2192,7 @@ enum wined3d_conversion_type
WINED3D_CT_CK_5551,
WINED3D_CT_CK_RGB24,
WINED3D_CT_RGB32_888,
+ WINED3D_CT_CK_ARGB32,
};
HRESULT d3dfmt_get_conv(const struct wined3d_surface *surface, BOOL need_alpha_ck, BOOL use_texturing,
More information about the wine-cvs
mailing list