Commit 9aa55562 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdi: Add test case for creating pens, make it pass under Wine for

cosmetic pens.
parent 70057595
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "config.h" #include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include "windef.h" #include "windef.h"
...@@ -84,9 +85,21 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen ) ...@@ -84,9 +85,21 @@ HPEN WINAPI CreatePenIndirect( const LOGPEN * pen )
if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, (HGDIOBJ *)&hpen, if (!(penPtr = GDI_AllocObject( sizeof(PENOBJ), PEN_MAGIC, (HGDIOBJ *)&hpen,
&pen_funcs ))) return 0; &pen_funcs ))) return 0;
penPtr->logpen.lopnStyle = pen->lopnStyle; if (pen->lopnStyle == PS_USERSTYLE || pen->lopnStyle == PS_ALTERNATE)
penPtr->logpen.lopnWidth = pen->lopnWidth; penPtr->logpen.lopnStyle = PS_SOLID;
penPtr->logpen.lopnColor = pen->lopnColor; else
penPtr->logpen.lopnStyle = pen->lopnStyle;
penPtr->logpen.lopnWidth.y = 0;
if (pen->lopnStyle == PS_NULL)
{
penPtr->logpen.lopnWidth.x = 1;
penPtr->logpen.lopnColor = RGB(0, 0, 0);
}
else
{
penPtr->logpen.lopnWidth.x = abs(pen->lopnWidth.x);
penPtr->logpen.lopnColor = pen->lopnColor;
}
GDI_ReleaseObj( hpen ); GDI_ReleaseObj( hpen );
return hpen; return hpen;
} }
...@@ -174,7 +187,18 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer ) ...@@ -174,7 +187,18 @@ static INT PEN_GetObject( HGDIOBJ handle, void *obj, INT count, LPVOID buffer )
if( !buffer ) if( !buffer )
return sizeof(pen->logpen); return sizeof(pen->logpen);
if (count > sizeof(pen->logpen)) count = sizeof(pen->logpen); switch (count)
memcpy( buffer, &pen->logpen, count ); {
return count; case sizeof(EXTLOGPEN):
FIXME("extended pens not supported\n");
return 0;
case sizeof(LOGPEN):
memcpy( buffer, &pen->logpen, sizeof(LOGPEN) );
return sizeof(LOGPEN);
default:
break;
}
return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment