Henri Verbeet : wined3d: Introduce a separate function for WINED3D_CT_CK_B8G8R8X8.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 3 03:04:12 CDT 2014


Module: wine
Branch: master
Commit: dabe5b4479521e16a040849b34dea247dd520dc0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dabe5b4479521e16a040849b34dea247dd520dc0

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Oct  3 09:19:19 2014 +0200

wined3d: Introduce a separate function for WINED3D_CT_CK_B8G8R8X8.

---

 dlls/wined3d/surface.c | 40 +++++++++++++++++++++++++---------------
 1 file changed, 25 insertions(+), 15 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 7dde5e4..e5f34f0 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3259,6 +3259,29 @@ static void convert_b8g8r8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsig
     }
 }
 
+static void convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key(const BYTE *src, unsigned int src_pitch,
+        BYTE *dst, unsigned int dst_pitch, unsigned int width, unsigned int height,
+        const struct wined3d_color_key *color_key)
+{
+    const DWORD *src_row;
+    unsigned int x, y;
+    DWORD *dst_row;
+
+    for (y = 0; y < height; ++y)
+    {
+        src_row = (DWORD *)&src[src_pitch * y];
+        dst_row = (DWORD *)&dst[dst_pitch * y];
+        for (x = 0; x < width; ++x)
+        {
+            DWORD src_color = src_row[x];
+            if (color_in_range(color_key, src_color))
+                dst_row[x] = src_color & ~0xff000000;
+            else
+                dst_row[x] = src_color | 0xff000000;
+        }
+    }
+}
+
 static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height,
         UINT outpitch, enum wined3d_conversion_type conversion_type, struct wined3d_surface *surface)
 {
@@ -3297,21 +3320,8 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI
             break;
 
         case WINED3D_CT_CK_B8G8R8X8:
-            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(&texture->src_blt_color_key, color))
-                        *(DWORD *)dest = color & ~0xff000000;
-                    else
-                        *(DWORD *)dest = color | 0xff000000;
-                    source += 4;
-                    dest += 4;
-                }
-            }
+            convert_b8g8r8x8_unorm_b8g8r8a8_unorm_color_key(src, pitch, dst, outpitch,
+                    width, height, &texture->src_blt_color_key);
             break;
 
         case WINED3D_CT_CK_B8G8R8A8:




More information about the wine-cvs mailing list