gdi32: Introduce NtGdiCreatePen.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-07-05 13:40:15 +02:00 committed by Alexandre Julliard
parent 4590f6fb4f
commit f5c117fb78
3 changed files with 24 additions and 20 deletions

View File

@ -177,3 +177,12 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN *pen )
{ {
return CreatePen( pen->lopnStyle, pen->lopnWidth.x, pen->lopnColor ); return CreatePen( pen->lopnStyle, pen->lopnWidth.x, pen->lopnColor );
} }
/***********************************************************************
* CreatePen (GDI32.@)
*/
HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
{
if (style < 0 || style > PS_INSIDEFRAME) style = PS_SOLID;
return NtGdiCreatePen( style, width, color, NULL );
}

View File

@ -52,27 +52,15 @@ static const struct gdi_obj_funcs pen_funcs =
/*********************************************************************** /***********************************************************************
* CreatePen (GDI32.@) * NtGdiCreatePen (win32u.@)
*/ */
HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush )
{ {
PENOBJ *penPtr; PENOBJ *penPtr;
HPEN hpen; HPEN hpen;
TRACE( "%d %d %06x\n", style, width, color ); TRACE( "%d %d %06x\n", style, width, color );
if (brush) FIXME( "brush not supported\n" );
if (style == PS_NULL)
{
hpen = GetStockObject(NULL_PEN);
if (hpen) return hpen;
}
if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0;
penPtr->logpen.elpPenStyle = style;
penPtr->logpen.elpWidth = abs(width);
penPtr->logpen.elpColor = color;
penPtr->logpen.elpBrushStyle = BS_SOLID;
switch (style) switch (style)
{ {
@ -84,14 +72,21 @@ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
case PS_INSIDEFRAME: case PS_INSIDEFRAME:
break; break;
case PS_NULL: case PS_NULL:
penPtr->logpen.elpWidth = 1; if ((hpen = GetStockObject( NULL_PEN ))) return hpen;
penPtr->logpen.elpColor = 0; width = 1;
color = 0;
break; break;
default: default:
penPtr->logpen.elpPenStyle = PS_SOLID; return 0;
break;
} }
if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0;
penPtr->logpen.elpPenStyle = style;
penPtr->logpen.elpWidth = abs(width);
penPtr->logpen.elpColor = color;
penPtr->logpen.elpBrushStyle = BS_SOLID;
if (!(hpen = alloc_gdi_handle( &penPtr->obj, OBJ_PEN, &pen_funcs ))) if (!(hpen = alloc_gdi_handle( &penPtr->obj, OBJ_PEN, &pen_funcs )))
HeapFree( GetProcessHeap(), 0, penPtr ); HeapFree( GetProcessHeap(), 0, penPtr );
return hpen; return hpen;

View File

@ -68,7 +68,7 @@ HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *enumex, ULONG unk2, UL
ULONG unk4, void *data ); ULONG unk4, void *data );
HBRUSH WINAPI NtGdiCreateDIBBrush( const void* data, UINT coloruse ); HBRUSH WINAPI NtGdiCreateDIBBrush( const void* data, UINT coloruse );
HBRUSH WINAPI NtGdiCreatePatternBrushInternal( HBITMAP hbitmap, BOOL pen ); HBRUSH WINAPI NtGdiCreatePatternBrushInternal( HBITMAP hbitmap, BOOL pen );
HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color ); HPEN WINAPI NtGdiCreatePen( INT style, INT width, COLORREF color, HBRUSH brush );
HRGN WINAPI NtGdiCreateRectRgn( INT left, INT top, INT right, INT bottom ); HRGN WINAPI NtGdiCreateRectRgn( INT left, INT top, INT right, INT bottom );
HRGN WINAPI NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom, HRGN WINAPI NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
INT ellipse_width, INT ellipse_height ); INT ellipse_width, INT ellipse_height );