Huw Davies : gdi32: Initial SelectPen support.

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


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

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

gdi32: Initial SelectPen support.

---

 dlls/gdi32/Makefile.in      |    1 +
 dlls/gdi32/dibdrv/dc.c      |    2 +-
 dlls/gdi32/dibdrv/dibdrv.h  |    2 +
 dlls/gdi32/dibdrv/objects.c |   62 +++++++++++++++++++++++++++++++++++++++++++
 dlls/gdi32/gdi_private.h    |    3 ++
 5 files changed, 69 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in
index 9753ef4..4b070ac 100644
--- a/dlls/gdi32/Makefile.in
+++ b/dlls/gdi32/Makefile.in
@@ -15,6 +15,7 @@ C_SRCS = \
 	dc.c \
 	dib.c \
 	dibdrv/dc.c \
+	dibdrv/objects.c \
 	dibdrv/primitives.c \
 	driver.c \
 	enhmetafile.c \
diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c
index 473bf82..b8b401d 100644
--- a/dlls/gdi32/dibdrv/dc.c
+++ b/dlls/gdi32/dibdrv/dc.c
@@ -207,7 +207,7 @@ const DC_FUNCTIONS dib_driver =
     NULL,                               /* pSelectClipPath */
     NULL,                               /* pSelectFont */
     NULL,                               /* pSelectPalette */
-    NULL,                               /* pSelectPen */
+    dibdrv_SelectPen,                   /* pSelectPen */
     NULL,                               /* pSetArcDirection */
     NULL,                               /* pSetBitmapBits */
     NULL,                               /* pSetBkColor */
diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h
index 346b17a..766ca6c 100644
--- a/dlls/gdi32/dibdrv/dibdrv.h
+++ b/dlls/gdi32/dibdrv/dibdrv.h
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+extern HPEN     CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN;
+
 static inline dibdrv_physdev *get_dibdrv_pdev( PHYSDEV dev )
 {
     return (dibdrv_physdev *)dev;
diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c
new file mode 100644
index 0000000..ce3c1b2
--- /dev/null
+++ b/dlls/gdi32/dibdrv/objects.c
@@ -0,0 +1,62 @@
+/*
+ * DIB driver GDI objects.
+ *
+ * Copyright 2011 Huw Davies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "gdi_private.h"
+#include "dibdrv.h"
+
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(dib);
+
+/***********************************************************************
+ *           dibdrv_SelectPen
+ */
+HPEN CDECL dibdrv_SelectPen( PHYSDEV dev, HPEN hpen )
+{
+    PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSelectPen );
+    dibdrv_physdev *pdev = get_dibdrv_pdev(dev);
+    LOGPEN logpen;
+
+    TRACE("(%p, %p)\n", dev, hpen);
+
+    if (!GetObjectW( hpen, sizeof(logpen), &logpen ))
+    {
+        /* must be an extended pen */
+        EXTLOGPEN *elp;
+        INT size = GetObjectW( hpen, 0, NULL );
+
+        if (!size) return 0;
+
+        elp = HeapAlloc( GetProcessHeap(), 0, size );
+
+        GetObjectW( hpen, size, elp );
+        /* FIXME: add support for user style pens */
+        logpen.lopnStyle = elp->elpPenStyle;
+        logpen.lopnWidth.x = elp->elpWidth;
+        logpen.lopnWidth.y = 0;
+        logpen.lopnColor = elp->elpColor;
+
+        HeapFree( GetProcessHeap(), 0, elp );
+    }
+
+    pdev->pen_color = pdev->dib.funcs->colorref_to_pixel(&pdev->dib, logpen.lopnColor);
+
+    return next->funcs->pSelectPen( next, hpen );
+}
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index 5f27106..6629ee6 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -96,6 +96,9 @@ typedef struct dibdrv_physdev
 {
     struct gdi_physdev dev;
     dib_info dib;
+
+    /* pen */
+    DWORD pen_color;
 } dibdrv_physdev;
 
 typedef struct tagDC_FUNCS




More information about the wine-cvs mailing list