Huw Davies : gdi32: Add support for DC pens.

Alexandre Julliard julliard at winehq.org
Thu Apr 7 11:16:42 CDT 2011


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Apr  7 13:47:59 2011 +0100

gdi32: Add support for DC pens.

---

 dlls/gdi32/dibdrv/dc.c      |    2 +-
 dlls/gdi32/dibdrv/dibdrv.h  |    1 +
 dlls/gdi32/dibdrv/objects.c |   17 +++++++++++++++++
 3 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index d24ef37..806f089 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -216,7 +216,7 @@ const DC_FUNCTIONS dib_driver =
     NULL,                               /* pSetBkColor */
     NULL,                               /* pSetBkMode */
     NULL,                               /* pSetDCBrushColor */
-    NULL,                               /* pSetDCPenColor */
+    dibdrv_SetDCPenColor,               /* pSetDCPenColor */
     NULL,                               /* pSetDIBColorTable */
     NULL,                               /* pSetDIBits */
     NULL,                               /* pSetDIBitsToDevice */
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index 766ca6c..d33bf88 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -19,6 +19,7 @@
  */
 
 extern HPEN     CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
+extern COLORREF CDECL dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
 
 static inline dibdrv_physdev *get_dibdrv_pdev( PHYSDEV dev )
 {
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
index c9862dc..02df7cf 100644
--- a/dlls/gdi32/dibdrv/objects.c
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -56,6 +56,9 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
         HeapFree( GetProcessHeap(), 0, elp );
     }
 
+    if (hpen == GetStockObject( DC_PEN ))
+        logpen.lopnColor = GetDCPenColor( dev->hdc );
+
     pdev->pen_color = pdev->dib.funcs->colorref_to_pixel(&pdev->dib, logpen.lopnColor);
 
     pdev->defer |= DEFER_PEN;
@@ -73,3 +76,17 @@ HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
 
     return next->funcs->pSelectPen( next, hpen );
 }
+
+/***********************************************************************
+ *           dibdrv_SetDCPenColor
+ */
+COLORREF CDECL dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color )
+{
+    PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDCPenColor );
+    dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
+
+    if (GetCurrentObject(dev->hdc, OBJ_PEN) == GetStockObject( DC_PEN ))
+        pdev->pen_color = pdev->dib.funcs->colorref_to_pixel(&pdev->dib, color);
+
+    return next->funcs->pSetDCPenColor( next, color );
+}




More information about the wine-cvs mailing list