Christian Costa : wined3d: Implement CONVERT_CK_RGB24 in d3dfmt_convert_surface.

Alexandre Julliard julliard at winehq.org
Mon Nov 24 09:16:39 CST 2008


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

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Sun Nov 23 21:31:51 2008 +0100

wined3d: Implement CONVERT_CK_RGB24 in d3dfmt_convert_surface.

---

 dlls/wined3d/surface.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1849b83..77f32ef 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -1845,6 +1845,29 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
         }
         break;
 
+        case CONVERT_CK_RGB24:
+        {
+            /* Converting R8G8B8 format to R8G8B8A8 with color-keying. */
+            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 = ((DWORD)source[0] << 16) + ((DWORD)source[1] << 8) + (DWORD)source[2] ;
+                    DWORD dstcolor = color << 8;
+                    if ((color < This->SrcBltCKey.dwColorSpaceLowValue) ||
+                        (color > This->SrcBltCKey.dwColorSpaceHighValue)) {
+                        dstcolor |= 0xff;
+                    }
+                    *(DWORD*)dest = dstcolor;
+                    source += 3;
+                    dest += 4;
+                }
+            }
+        }
+        break;
+
         case CONVERT_RGB32_888:
         {
             /* Converting X8R8G8B8 format to R8G8B8A8 with color-keying. */




More information about the wine-cvs mailing list