Module: wine Branch: master Commit: 4590f6fb4f87e738afd1de147e740555c4fdbd3a URL: https://source.winehq.org/git/wine.git/?a=commit;h=4590f6fb4f87e738afd1de147...
Author: Jacek Caban jacek@codeweavers.com Date: Mon Jul 5 13:40:07 2021 +0200
gdi32: Implement CreatePenIndirect on top of CreatePen.
Instead of the other way around.
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 | 8 ++++++++ dlls/gdi32/pen.c | 32 ++++++++------------------------ 2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/dlls/gdi32/objects.c b/dlls/gdi32/objects.c index 664dcf4f043..7fbb0419ec8 100644 --- a/dlls/gdi32/objects.c +++ b/dlls/gdi32/objects.c @@ -169,3 +169,11 @@ INT WINAPI GetObjectA( HGDIOBJ handle, INT count, void *buffer )
return GetObjectW( handle, count, buffer ); } + +/*********************************************************************** + * CreatePenIndirect (GDI32.@) + */ +HPEN WINAPI CreatePenIndirect( const LOGPEN *pen ) +{ + return CreatePen( pen->lopnStyle, pen->lopnWidth.x, pen->lopnColor ); +} diff --git a/dlls/gdi32/pen.c b/dlls/gdi32/pen.c index 8a01125b390..1fbd467d105 100644 --- a/dlls/gdi32/pen.c +++ b/dlls/gdi32/pen.c @@ -56,28 +56,12 @@ static const struct gdi_obj_funcs pen_funcs = */ HPEN WINAPI CreatePen( INT style, INT width, COLORREF color ) { - LOGPEN logpen; - - TRACE("%d %d %06x\n", style, width, color ); - - logpen.lopnStyle = style; - logpen.lopnWidth.x = width; - logpen.lopnWidth.y = 0; - logpen.lopnColor = color; - - return CreatePenIndirect( &logpen ); -} - - -/*********************************************************************** - * CreatePenIndirect (GDI32.@) - */ -HPEN WINAPI CreatePenIndirect( const LOGPEN * pen ) -{ - PENOBJ * penPtr; + PENOBJ *penPtr; HPEN hpen;
- if (pen->lopnStyle == PS_NULL) + TRACE( "%d %d %06x\n", style, width, color ); + + if (style == PS_NULL) { hpen = GetStockObject(NULL_PEN); if (hpen) return hpen; @@ -85,12 +69,12 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
if (!(penPtr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*penPtr) ))) return 0;
- penPtr->logpen.elpPenStyle = pen->lopnStyle; - penPtr->logpen.elpWidth = abs(pen->lopnWidth.x); - penPtr->logpen.elpColor = pen->lopnColor; + penPtr->logpen.elpPenStyle = style; + penPtr->logpen.elpWidth = abs(width); + penPtr->logpen.elpColor = color; penPtr->logpen.elpBrushStyle = BS_SOLID;
- switch (pen->lopnStyle) + switch (style) { case PS_SOLID: case PS_DASH: