Henri Verbeet : ddraw: Properly clear the clip list if ddraw_clipper_SetClipList() is called with NULL region data.

Alexandre Julliard julliard at winehq.org
Tue Jan 10 13:11:18 CST 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Jan  9 22:16:49 2012 +0100

ddraw: Properly clear the clip list if ddraw_clipper_SetClipList() is called with NULL region data.

---

 dlls/ddraw/clipper.c      |    6 ++++--
 dlls/ddraw/tests/ddraw1.c |    6 ++++++
 dlls/ddraw/tests/ddraw2.c |    6 ++++++
 dlls/ddraw/tests/ddraw4.c |    6 ++++++
 dlls/ddraw/tests/ddraw7.c |    6 ++++++
 5 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/dlls/ddraw/clipper.c b/dlls/ddraw/clipper.c
index 6e40bab..81e9e8b 100644
--- a/dlls/ddraw/clipper.c
+++ b/dlls/ddraw/clipper.c
@@ -238,10 +238,12 @@ static HRESULT WINAPI ddraw_clipper_SetClipList(IDirectDrawClipper *iface, RGNDA
 
     if (clipper->region)
         DeleteObject(clipper->region);
-    if (!(clipper->region = ExtCreateRegion(NULL, 0, region)))
+    if (!region)
+        clipper->region = NULL;
+    else if (!(clipper->region = ExtCreateRegion(NULL, 0, region)))
     {
         wined3d_mutex_unlock();
-        ERR("Failed to create creation.\n");
+        ERR("Failed to create region.\n");
         return E_FAIL;
     }
 
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 6612c4d..13464af 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -339,6 +339,12 @@ static void test_clipper_blt(void)
     ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
     hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
     ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
+    ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
+    hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
 
     IDirectDrawSurface_Release(dst_surface);
     IDirectDrawSurface_Release(src_surface);
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 4d9bf98..8146ff6 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -346,6 +346,12 @@ static void test_clipper_blt(void)
     ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
     hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
     ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
+    ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
+    hr = IDirectDrawSurface_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
 
     IDirectDrawSurface_Release(dst_surface);
     IDirectDrawSurface_Release(src_surface);
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index c3e550d..65725b3 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -641,6 +641,12 @@ static void test_clipper_blt(void)
     ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
     hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
     ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
+    ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
+    hr = IDirectDrawSurface4_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
 
     IDirectDrawSurface4_Release(dst_surface);
     IDirectDrawSurface4_Release(src_surface);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 3cdfd2b..0826346 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -634,6 +634,12 @@ static void test_clipper_blt(void)
     ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#x.\n", hr);
     hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
     ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_SetClipList(clipper, NULL, 0);
+    ok(SUCCEEDED(hr), "Failed to set clip list, hr %#x.\n", hr);
+    hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
+    hr = IDirectDrawSurface7_Blt(dst_surface, NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx);
+    ok(hr == DDERR_NOCLIPLIST, "Got unexpected hr %#x.\n", hr);
 
     IDirectDrawSurface7_Release(dst_surface);
     IDirectDrawSurface7_Release(src_surface);




More information about the wine-cvs mailing list