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>
This commit is contained in:
Jacek Caban 2021-07-05 13:40:07 +02:00 committed by Alexandre Julliard
parent 3dcb5db47f
commit 4590f6fb4f
2 changed files with 16 additions and 24 deletions

View File

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

View File

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