Module: wine Branch: master Commit: f5c117fb78b8530a31fb15eff7936b1b37aef7de URL: https://source.winehq.org/git/wine.git/?a=commit;h=f5c117fb78b8530a31fb15eff...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Jul 5 13:40:15 2021 +0200
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
---
dlls/gdi32/objects.c | 9 +++++++++ dlls/gdi32/pen.c | 33 ++++++++++++++------------------- include/ntgdi.h | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-)
diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 7fbb0419ec8..0e8453f4af2 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -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 ); +} diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 1fbd467d105..7790278fca6 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -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; diff --git a/include/ntgdi.h b/include/ntgdi.h index b4501c46b4e..778f589f550 100644 --- a/include/ntgdi.h +++ b/include/ntgdi.h @@ -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 );