Huw Davies : gdi32: Add the ability to disable a DC.

Alexandre Julliard julliard at winehq.org
Thu Jan 26 14:53:14 CST 2017


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Jan 26 09:30:19 2017 +0000

gdi32: Add the ability to disable a DC.

Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/dc.c           | 10 ++++++++++
 dlls/gdi32/gdi_private.h  |  1 +
 include/wine/gdi_driver.h |  2 ++
 3 files changed, 13 insertions(+)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 27e89ae..892d3e9 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -203,6 +203,11 @@ DC *get_dc_ptr( HDC hdc )
 {
     DC *dc = get_dc_obj( hdc );
     if (!dc) return NULL;
+    if (dc->disabled)
+    {
+        GDI_ReleaseObj( hdc );
+        return NULL;
+    }
 
     if (!InterlockedCompareExchange( &dc->refcount, 1, 0 ))
     {
@@ -1269,6 +1274,11 @@ WORD WINAPI SetHookFlags( HDC hdc, WORD flags )
     else if (flags & DCHF_VALIDATEVISRGN || !flags)
         ret = InterlockedExchange( &dc->dirty, 0 );
 
+    if (flags & DCHF_DISABLEDC)
+        ret = InterlockedExchange( &dc->disabled, 1 );
+    else if (flags & DCHF_ENABLEDC)
+        ret = InterlockedExchange( &dc->disabled, 0 );
+
     GDI_ReleaseObj( hdc );
 
     if (flags & DCHF_RESETDC) ret = reset_dc_state( hdc );
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index e4633d1..ab3c9bb 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -65,6 +65,7 @@ typedef struct tagDC
     DWORD        thread;           /* thread owning the DC */
     LONG         refcount;         /* thread refcount */
     LONG         dirty;            /* dirty flag */
+    LONG         disabled;         /* get_dc_ptr() will return NULL.  Controlled by DCHF_(DISABLE|ENABLE)DC */
     INT          saveLevel;
     struct tagDC *saved_dc;
     DWORD_PTR    dwHookData;
diff --git a/include/wine/gdi_driver.h b/include/wine/gdi_driver.h
index 6f67653..32d17f7 100644
--- a/include/wine/gdi_driver.h
+++ b/include/wine/gdi_driver.h
@@ -266,6 +266,8 @@ static inline ULONG window_surface_release( struct window_surface *surface )
 #define DCHF_INVALIDATEVISRGN   0x0001
 #define DCHF_VALIDATEVISRGN     0x0002
 #define DCHF_RESETDC            0x0004  /* Wine extension */
+#define DCHF_DISABLEDC          0x0008  /* Wine extension */
+#define DCHF_ENABLEDC           0x0010  /* Wine extension */
 
 typedef BOOL (CALLBACK *DCHOOKPROC)(HDC,WORD,DWORD_PTR,LPARAM);
 




More information about the wine-cvs mailing list