Implement IDirectDrawClipper_GetClipList For Window Case

Robert Shearman rob at codeweavers.com
Mon Aug 23 22:00:29 CDT 2004


Changelog:
Implement IDirectDrawClipper_GetClipList for case where we have a handle 
to a window.

-------------- next part --------------
Index: wine/dlls/ddraw/dclipper/main.c
===================================================================
RCS file: /home/wine/wine/dlls/ddraw/dclipper/main.c,v
retrieving revision 1.12
diff -u -p -r1.12 main.c
--- wine/dlls/ddraw/dclipper/main.c	23 Aug 2004 19:40:00 -0000	1.12
+++ wine/dlls/ddraw/dclipper/main.c	24 Aug 2004 02:55:55 -0000
@@ -143,14 +143,42 @@ ULONG WINAPI Main_DirectDrawClipper_Rele
 */
 HRESULT WINAPI Main_DirectDrawClipper_GetClipList(
     LPDIRECTDRAWCLIPPER iface, LPRECT lpRect, LPRGNDATA lpClipList,
-    LPDWORD lpdwSize
-) {
+    LPDWORD lpdwSize)
+{
     ICOM_THIS(IDirectDrawClipperImpl,iface);
-    static int warned = 0;
-    if (warned++ < 10)
-	FIXME("(%p,%p,%p,%p),stub!\n",This,lpRect,lpClipList,lpdwSize);
-    if (lpdwSize) *lpdwSize=0;
-    return DDERR_NOCLIPLIST;
+
+	TRACE("(%p,%p,%p,%p)\n", This, lpRect, lpClipList, lpdwSize);
+
+    if (This->hWnd)
+    {
+        HDC hDC = GetDCEx(This->hWnd, NULL, DCX_WINDOW);
+        if (hDC)
+        {
+            HRGN hRgn = CreateRectRgn(0,0,0,0);
+            if (GetRandomRgn(hDC, hRgn, SYSRGN))
+            {
+                if (lpRect)
+                {
+                    HRGN hRgnClip = CreateRectRgn(lpRect->left, lpRect->top,
+                        lpRect->right, lpRect->bottom);
+                    CombineRgn(hRgn, hRgn, hRgnClip, RGN_AND);
+                    DeleteObject(hRgnClip);
+                }
+                *lpdwSize = GetRegionData(hRgn, *lpdwSize, lpClipList);
+            }
+            DeleteObject(hRgn);
+            ReleaseDC(This->hWnd, hDC);
+        }
+        return DD_OK;
+    }
+    else
+    {
+        static int warned = 0;
+        if (warned++ < 10)
+            FIXME("(%p,%p,%p,%p),stub!\n",This,lpRect,lpClipList,lpdwSize);
+        if (lpdwSize) *lpdwSize=0;
+        return DDERR_NOCLIPLIST;
+    }
 }
 
 /***********************************************************************


More information about the wine-patches mailing list