[PATCH 2/2] user32: Disable cached DCs once they are released.
Huw Davies
huw at codeweavers.com
Thu Jan 26 03:30:20 CST 2017
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/user32/painting.c | 13 ++++++++++---
dlls/user32/tests/dce.c | 4 ++--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/user32/painting.c b/dlls/user32/painting.c
index 622dcad..7a6b0dc 100644
--- a/dlls/user32/painting.c
+++ b/dlls/user32/painting.c
@@ -476,7 +476,11 @@ static INT release_dc( HWND hwnd, HDC hdc, BOOL end_paint )
{
if (!(dce->flags & DCX_NORESETATTRS)) SetHookFlags( dce->hdc, DCHF_RESETDC );
if (end_paint || (dce->flags & DCX_CACHE)) delete_clip_rgn( dce );
- if (dce->flags & DCX_CACHE) dce->count = 0;
+ if (dce->flags & DCX_CACHE)
+ {
+ dce->count = 0;
+ SetHookFlags( dce->hdc, DCHF_DISABLEDC );
+ }
ret = TRUE;
}
USER_Unlock();
@@ -1007,8 +1011,11 @@ HDC WINAPI GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
if (!found && count >= DCE_CACHE_SIZE) found = dceUnused;
dce = found;
- if (dce) dce->count = 1;
-
+ if (dce)
+ {
+ dce->count = 1;
+ SetHookFlags( dce->hdc, DCHF_ENABLEDC );
+ }
USER_Unlock();
/* if there's no dce empty or unused, allocate a new one */
diff --git a/dlls/user32/tests/dce.c b/dlls/user32/tests/dce.c
index b5f9722..382d10a 100644
--- a/dlls/user32/tests/dce.c
+++ b/dlls/user32/tests/dce.c
@@ -112,9 +112,9 @@ static void test_dc_attributes(void)
/* Released cache DCs are 'disabled' */
rop = SetROP2( old_hdc, R2_BLACK );
- todo_wine ok( rop == 0, "got %d\n", rop );
+ ok( rop == 0, "got %d\n", rop );
rop = GetROP2( old_hdc );
- todo_wine ok( rop == 0, "got %d\n", rop );
+ ok( rop == 0, "got %d\n", rop );
/* test own DC */
--
2.10.2
More information about the wine-patches
mailing list