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 );
}
/***********************************************************************
* 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;
HPEN hpen;
TRACE( "%d %d %06x\n", style, width, color );
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;
if (brush) FIXME( "brush not supported\n" );
switch (style)
{
@ -84,14 +72,21 @@ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color )
case PS_INSIDEFRAME:
break;
case PS_NULL:
penPtr->logpen.elpWidth = 1;
penPtr->logpen.elpColor = 0;
if ((hpen = GetStockObject( NULL_PEN ))) return hpen;
width = 1;
color = 0;
break;
default:
penPtr->logpen.elpPenStyle = PS_SOLID;
break;
return 0;
}
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 )))
HeapFree( GetProcessHeap(), 0, penPtr );
return hpen;

View file

@ -68,7 +68,7 @@ HFONT WINAPI NtGdiHfontCreate( const ENUMLOGFONTEXDVW *enumex, ULONG unk2, UL
ULONG unk4, void *data );
HBRUSH WINAPI NtGdiCreateDIBBrush( const void* data, UINT coloruse );
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 NtGdiCreateRoundRectRgn( INT left, INT top, INT right, INT bottom,
INT ellipse_width, INT ellipse_height );