xref: /reactos/win32ss/gdi/gdi32/objects/pen.c (revision d2aeaba5)
1 #include <precomp.h>
2 
3 #define NDEBUG
4 #include <debug.h>
5 
6 /*
7  * @implemented
8  */
9 HPEN WINAPI
10 CreatePenIndirect(
11     const LOGPEN *lplgpn)
12 {
13     /* Note same behoir as Windows 2000/XP/VISTA, they do not care if  plgpn is NULL�, it will crash */
14     return CreatePen(lplgpn->lopnStyle, lplgpn->lopnWidth.x, lplgpn->lopnColor);
15 }
16 
17 /*
18  * @implemented
19  */
20 HPEN WINAPI
21 CreatePen(
22     int nPenStyle,
23     int nWidth,
24     COLORREF crColor)
25 {
26 /*    HPEN hPen;
27     PBRUSH_ATTR Pen_Attr;
28 */
29     if (nPenStyle < PS_SOLID) nPenStyle = PS_SOLID;
30     if (nPenStyle > PS_DASHDOTDOT)
31     {
32         if (nPenStyle == PS_NULL) return GetStockObject(NULL_PEN);
33         if (nPenStyle != PS_INSIDEFRAME) nPenStyle = PS_SOLID;
34     }
35 #if 0
36     hPen = hGetPEBHandle(hctPenHandle, nPenStyle);
37     if ( nWidth || nPenStyle || !hPen )
38     {
39        return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL);
40     }
41 
42     if ((GdiGetHandleUserData( hPen, GDI_OBJECT_TYPE_PEN, (PVOID) &Pen_Attr)) &&
43         ( Pen_Attr != NULL ))
44     {
45         if ( Pen_Attr->lbColor != crColor)
46         {
47            Pen_Attr->lbColor = crColor;
48            Pen_Attr->AttrFlags |= ATTR_NEW_COLOR;
49         }
50         return hPen;
51     }
52     DeleteObject(hPen);
53 #endif
54     return NtGdiCreatePen(nPenStyle, nWidth, crColor, NULL);
55 }
56 
57