gdi32: Initial SelectPen support.

This commit is contained in:
Huw Davies 2011-04-07 13:46:33 +01:00 committed by Alexandre Julliard
parent f382478377
commit ed23e3de5c
5 changed files with 69 additions and 1 deletions

View File

@ -15,6 +15,7 @@ C_SRCS = \
dc.c \
dib.c \
dibdrv/dc.c \
dibdrv/objects.c \
dibdrv/primitives.c \
driver.c \
enhmetafile.c \

View File

@ -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 */

View File

@ -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;

View File

@ -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 );
}

View File

@ -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