Module: wine Branch: master Commit: 924fad9d25c928422ac66b5e13b2312151dc208b URL: http://source.winehq.org/git/wine.git/?a=commit;h=924fad9d25c928422ac66b5e13...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Tue Jun 18 13:12:54 2013 +0900
gdi32: ExtSelectClipRgn(hdc, 0, RGN_DIFF) is supposed to fail.
---
dlls/gdi32/clipping.c | 15 +++++++++++---- dlls/gdi32/tests/clipping.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/clipping.c b/dlls/gdi32/clipping.c index 572287e..ccd61d0 100644 --- a/dlls/gdi32/clipping.c +++ b/dlls/gdi32/clipping.c @@ -148,14 +148,21 @@ INT nulldrv_ExtSelectClipRgn( PHYSDEV dev, HRGN rgn, INT mode )
if (!rgn) { - if (mode != RGN_COPY) + switch (mode) { + case RGN_COPY: + if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); + dc->hClipRgn = 0; + ret = SIMPLEREGION; + break; + + case RGN_DIFF: + return ERROR; + + default: FIXME("Unimplemented: hrgn NULL in mode: %d\n", mode); return ERROR; } - if (dc->hClipRgn) DeleteObject( dc->hClipRgn ); - dc->hClipRgn = 0; - ret = SIMPLEREGION; } else { diff --git a/dlls/gdi32/tests/clipping.c b/dlls/gdi32/tests/clipping.c index 0247bbb..6257c17 100644 --- a/dlls/gdi32/tests/clipping.c +++ b/dlls/gdi32/tests/clipping.c @@ -2,6 +2,7 @@ * Unit test suite for clipping * * Copyright 2005 Huw Davies + * Copyright 2008,2011,2013 Dmitry Timoshkov * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -388,6 +389,12 @@ static void test_memory_dc_clipping(void) ret = GetClipRgn(hdc, hrgn); ok(ret == 0, "expected 0, got %d\n", ret);
+ ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF); + ok(ret == 0, "expected 0, got %d\n", ret); + + ret = GetClipRgn(hdc, hrgn); + ok(ret == 0, "expected 0, got %d\n", ret); + SelectObject(hdc, hbmp);
ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF); @@ -409,6 +416,17 @@ static void test_memory_dc_clipping(void) ret = RectVisible( hdc, &rc ); ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
+ ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF); + ok(ret == 0, "expected 0, got %d\n", ret); + + ret = GetClipRgn(hdc, hrgn); + ok(ret == 1, "expected 1, got %d\n", ret); + + ret = GetRgnBox(hrgn, &rc); + ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); + ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100, + "expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom); + DeleteDC(hdc); DeleteObject(hrgn); DeleteObject(hrgn_empty); @@ -441,6 +459,12 @@ static void test_window_dc_clipping(void) ret = GetClipRgn(hdc, hrgn); ok(ret == 0, "expected 0, got %d\n", ret);
+ ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF); + ok(ret == 0, "expected 0, got %d\n", ret); + + ret = GetClipRgn(hdc, hrgn); + ok(ret == 0, "expected 0, got %d\n", ret); + ret = ExtSelectClipRgn(hdc, hrgn_empty, RGN_DIFF); ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1), "expected SIMPLEREGION, got %d\n", ret); @@ -462,6 +486,18 @@ static void test_window_dc_clipping(void) ret = RectVisible( hdc, &rc ); ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
+ ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF); + ok(ret == 0, "expected 0, got %d\n", ret); + + ret = GetClipRgn(hdc, hrgn); + ok(ret == 1, "expected 1, got %d\n", ret); + + ret = GetRgnBox(hrgn, &rc); + ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); + ok(rc.left == 0 && rc.top == 0 && rc.right == screen_width && rc.bottom == screen_height, + "expected 0,0-%d,%d, got %d,%d-%d,%d\n", screen_width, screen_height, + rc.left, rc.top, rc.right, rc.bottom); + ret = ExtSelectClipRgn(hdc, 0, RGN_COPY); ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1), "expected SIMPLEREGION, got %d\n", ret);