ReactOS  0.4.14-dev-583-g2a1ba2c
pen.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for pen.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static VOID PEN_vInit (PPEN ppen)
 
PBRUSH NTAPI PEN_AllocPenWithHandle (VOID)
 
PBRUSH NTAPI PEN_AllocExtPenWithHandle (VOID)
 
PBRUSH FASTCALL PEN_ShareLockPen (HPEN hobj)
 
HPEN APIENTRY IntGdiExtCreatePen (DWORD dwPenStyle, DWORD dwWidth, IN ULONG ulBrushStyle, IN ULONG ulColor, IN ULONG_PTR ulClientHatch, IN ULONG_PTR ulHatch, DWORD dwStyleCount, PULONG pStyle, IN ULONG cjDIB, IN BOOL bOldStylePen, IN OPTIONAL HBRUSH hbrush)
 
VOID FASTCALL IntGdiSetSolidPenColor (HPEN hPen, COLORREF Color)
 
INT APIENTRY PEN_GetObject (PBRUSH pbrushPen, INT cbCount, PLOGPEN pBuffer)
 
HPEN APIENTRY NtGdiCreatePen (INT PenStyle, INT Width, COLORREF Color, IN HBRUSH hbr)
 
HPEN APIENTRY NtGdiExtCreatePen (DWORD dwPenStyle, DWORD ulWidth, IN ULONG ulBrushStyle, IN ULONG ulColor, IN ULONG_PTR ulClientHatch, IN ULONG_PTR ulHatch, DWORD dwStyleCount, PULONG pUnsafeStyle, IN ULONG cjDIB, IN BOOL bOldStylePen, IN OPTIONAL HBRUSH hBrush)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file pen.c.

Function Documentation

◆ IntGdiExtCreatePen()

HPEN APIENTRY IntGdiExtCreatePen ( DWORD  dwPenStyle,
DWORD  dwWidth,
IN ULONG  ulBrushStyle,
IN ULONG  ulColor,
IN ULONG_PTR  ulClientHatch,
IN ULONG_PTR  ulHatch,
DWORD  dwStyleCount,
PULONG  pStyle,
IN ULONG  cjDIB,
IN BOOL  bOldStylePen,
IN OPTIONAL HBRUSH  hbrush 
)

Definition at line 74 of file pen.c.

86 {
87  HPEN hPen;
88  PBRUSH pbrushPen;
89  static ULONG aulStyleAlternate[] = { 1, 1 };
90  static ULONG aulStyleDash[] = { 6, 2 };
91  static ULONG aulStyleDot[] = { 1, 1 };
92  static ULONG aulStyleDashDot[] = { 3, 2, 1, 2 };
93  static ULONG aulStyleDashDotDot[] = { 3, 1, 1, 1, 1, 1 };
94  ULONG i;
95 
96  dwWidth = abs(dwWidth);
97 
98  if ( (dwPenStyle & PS_STYLE_MASK) == PS_NULL)
99  {
100  return StockObjects[NULL_PEN];
101  }
102 
103  if (bOldStylePen)
104  {
105  pbrushPen = PEN_AllocPenWithHandle();
106  }
107  else
108  {
109  pbrushPen = PEN_AllocExtPenWithHandle();
110  }
111 
112  if (!pbrushPen)
113  {
115  DPRINT("Can't allocate pen\n");
116  return 0;
117  }
118  hPen = pbrushPen->BaseObject.hHmgr;
119 
120  // If nWidth is zero, the pen is a single pixel wide, regardless of the current transformation.
121  if ((bOldStylePen) && (!dwWidth) && ((dwPenStyle & PS_STYLE_MASK) != PS_SOLID))
122  dwWidth = 1;
123 
124  pbrushPen->lWidth = dwWidth;
125  FLOATOBJ_SetLong(&pbrushPen->eWidth, pbrushPen->lWidth);
126  pbrushPen->ulPenStyle = dwPenStyle;
127  pbrushPen->BrushAttr.lbColor = ulColor;
128  pbrushPen->iBrushStyle = ulBrushStyle;
129  // FIXME: Copy the bitmap first ?
130  pbrushPen->hbmClient = (HANDLE)ulClientHatch;
131  pbrushPen->dwStyleCount = 0;
132  pbrushPen->pStyle = NULL;
133  pbrushPen->ulStyleSize = 0;
134 
135  pbrushPen->flAttrs = bOldStylePen ? BR_IS_OLDSTYLEPEN : BR_IS_PEN;
136 
137  // If dwPenStyle is PS_COSMETIC, the width must be set to 1.
138  if ( !(bOldStylePen) && ((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC) && ( dwWidth != 1) )
139  goto ExitCleanup;
140  // If dwPenStyle is PS_COSMETIC, the brush style must be BS_SOLID.
141  if ( !(bOldStylePen) && ((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC) && (ulBrushStyle != BS_SOLID) )
142  goto ExitCleanup;
143 
144  switch (dwPenStyle & PS_STYLE_MASK)
145  {
146  case PS_NULL:
147  pbrushPen->flAttrs |= BR_IS_NULL;
148  break;
149 
150  case PS_SOLID:
151  pbrushPen->flAttrs |= BR_IS_SOLID;
152  break;
153 
154  case PS_ALTERNATE:
155  pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
156  pbrushPen->pStyle = aulStyleAlternate;
157  pbrushPen->dwStyleCount = _countof(aulStyleAlternate);
158  break;
159 
160  case PS_DOT:
161  pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
162  pbrushPen->pStyle = aulStyleDot;
163  pbrushPen->dwStyleCount = _countof(aulStyleDot);
164  break;
165 
166  case PS_DASH:
167  pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
168  pbrushPen->pStyle = aulStyleDash;
169  pbrushPen->dwStyleCount = _countof(aulStyleDash);
170  break;
171 
172  case PS_DASHDOT:
173  pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
174  pbrushPen->pStyle = aulStyleDashDot;
175  pbrushPen->dwStyleCount = _countof(aulStyleDashDot);
176  break;
177 
178  case PS_DASHDOTDOT:
179  pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
180  pbrushPen->pStyle = aulStyleDashDotDot;
181  pbrushPen->dwStyleCount = _countof(aulStyleDashDotDot);
182  break;
183 
184  case PS_INSIDEFRAME:
185  pbrushPen->flAttrs |= (BR_IS_SOLID | BR_IS_INSIDEFRAME);
186  break;
187 
188  case PS_USERSTYLE:
189  {
190  UINT i;
191  BOOL has_neg = FALSE, all_zero = TRUE;
192 
193  for(i = 0; (i < dwStyleCount) && !has_neg; i++)
194  {
195  has_neg = has_neg || (((INT)(pStyle[i])) < 0);
196  all_zero = all_zero && (pStyle[i] == 0);
197  }
198 
199  if(all_zero || has_neg)
200  {
201  goto ExitCleanup;
202  }
203  }
204  /* FIXME: What style here? */
205  pbrushPen->flAttrs |= BR_IS_SOLID;
206  pbrushPen->dwStyleCount = dwStyleCount;
207  pbrushPen->pStyle = pStyle;
208  break;
209 
210  default:
211  DPRINT1("IntGdiExtCreatePen unknown penstyle %x\n", dwPenStyle);
212  goto ExitCleanup;
213  }
214 
215  if (pbrushPen->pStyle != NULL)
216  {
217  for (i = 0; i < pbrushPen->dwStyleCount; i++)
218  {
219  pbrushPen->ulStyleSize += pbrushPen->pStyle[i];
220  }
221  }
222 
223  NT_ASSERT((pbrushPen->dwStyleCount == 0) || (pbrushPen->pStyle != NULL));
224 
225  PEN_UnlockPen(pbrushPen);
226  return hPen;
227 
228 ExitCleanup:
230  pbrushPen->pStyle = NULL;
231  GDIOBJ_vDeleteObject(&pbrushPen->BaseObject);
232 
233  return NULL;
234 }
#define BR_IS_PEN
Definition: brush.h:103
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define abs(i)
Definition: fconv.c:206
#define TRUE
Definition: types.h:120
#define PS_STYLE_MASK
Definition: wingdi.h:600
#define _countof(array)
Definition: fontsub.cpp:30
#define INT
Definition: polytest.cpp:20
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define BR_IS_SOLID
Definition: brush.h:97
#define PS_SOLID
Definition: wingdi.h:585
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BR_IS_OLDSTYLEPEN
Definition: brush.h:104
HGDIOBJ StockObjects[]
Definition: stockobj.c:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define NULL_PEN
Definition: wingdi.h:903
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define PS_COSMETIC
Definition: wingdi.h:583
Definition: types.h:100
#define PS_ALTERNATE
Definition: wingdi.h:584
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1108
PVOID HANDLE
Definition: typedefs.h:71
#define BR_IS_NULL
Definition: brush.h:101
#define PS_DASH
Definition: wingdi.h:586
PBRUSH NTAPI PEN_AllocPenWithHandle(VOID)
Definition: pen.c:27
#define PS_INSIDEFRAME
Definition: wingdi.h:592
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
#define PEN_UnlockPen(pPenObj)
Definition: pen.h:17
#define PS_TYPE_MASK
Definition: wingdi.h:602
#define BR_IS_DEFAULTSTYLE
Definition: brush.h:107
unsigned int UINT
Definition: ndis.h:50
#define PS_NULL
Definition: wingdi.h:590
#define PS_DASHDOTDOT
Definition: wingdi.h:589
#define PS_DASHDOT
Definition: wingdi.h:588
#define BR_IS_INSIDEFRAME
Definition: brush.h:109
PBRUSH NTAPI PEN_AllocExtPenWithHandle(VOID)
Definition: pen.c:44
#define DPRINT1
Definition: precomp.h:8
#define PS_DOT
Definition: wingdi.h:587
unsigned int ULONG
Definition: retypes.h:1
#define BS_SOLID
Definition: wingdi.h:1085
BASEOBJECT BaseObject
Definition: brush.h:56
#define PS_USERSTYLE
Definition: wingdi.h:591
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
static const WCHAR dwWidth[]
Definition: provider.c:62
#define NT_ASSERT
Definition: rtlfuncs.h:3312

Referenced by NtGdiCreatePen(), and NtGdiExtCreatePen().

◆ IntGdiSetSolidPenColor()

VOID FASTCALL IntGdiSetSolidPenColor ( HPEN  hPen,
COLORREF  Color 
)

Definition at line 238 of file pen.c.

239 {
240  PBRUSH pbrPen;
241 
242  pbrPen = PEN_ShareLockPen(hPen);
243  if (pbrPen)
244  {
245  if (pbrPen->flAttrs & BR_IS_SOLID)
246  {
247  pbrPen->BrushAttr.lbColor = Color & 0xFFFFFF;
248  }
249  PEN_ShareUnlockPen(pbrPen);
250  }
251 }
#define BR_IS_SOLID
Definition: brush.h:97
Definition: types.h:100
#define PEN_ShareUnlockPen(ppen)
Definition: pen.h:18
PBRUSH FASTCALL PEN_ShareLockPen(HPEN hobj)
Definition: pen.c:61

◆ NtGdiCreatePen()

HPEN APIENTRY NtGdiCreatePen ( INT  PenStyle,
INT  Width,
COLORREF  Color,
IN HBRUSH  hbr 
)

Definition at line 322 of file pen.c.

327 {
328  if ((PenStyle < PS_SOLID) ||( PenStyle > PS_INSIDEFRAME))
329  {
331  return NULL;
332  }
333 
334  return IntGdiExtCreatePen(PenStyle,
335  Width,
336  BS_SOLID,
337  Color,
338  0,
339  0,
340  0,
341  NULL,
342  0,
343  TRUE,
344  hbr);
345 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
#define PS_SOLID
Definition: wingdi.h:585
smooth NULL
Definition: ftsmooth.c:416
HPEN APIENTRY IntGdiExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, IN ULONG ulBrushStyle, IN ULONG ulColor, IN ULONG_PTR ulClientHatch, IN ULONG_PTR ulHatch, DWORD dwStyleCount, PULONG pStyle, IN ULONG cjDIB, IN BOOL bOldStylePen, IN OPTIONAL HBRUSH hbrush)
Definition: pen.c:74
#define PS_INSIDEFRAME
Definition: wingdi.h:592
#define BS_SOLID
Definition: wingdi.h:1085
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

Referenced by CreatePen().

◆ NtGdiExtCreatePen()

HPEN APIENTRY NtGdiExtCreatePen ( DWORD  dwPenStyle,
DWORD  ulWidth,
IN ULONG  ulBrushStyle,
IN ULONG  ulColor,
IN ULONG_PTR  ulClientHatch,
IN ULONG_PTR  ulHatch,
DWORD  dwStyleCount,
PULONG  pUnsafeStyle,
IN ULONG  cjDIB,
IN BOOL  bOldStylePen,
IN OPTIONAL HBRUSH  hBrush 
)

Definition at line 349 of file pen.c.

361 {
363  DWORD* pSafeStyle = NULL;
364  HPEN hPen;
365 
366  if ((int)dwStyleCount < 0) return 0;
367  if (dwStyleCount > 16)
368  {
370  return 0;
371  }
372 
373  if (((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC) &&
374  (ulBrushStyle != BS_SOLID))
375  {
377  return 0;
378  }
379 
380  if (((dwPenStyle & PS_STYLE_MASK) == PS_NULL) ||
381  (ulBrushStyle == BS_NULL))
382  {
383  return StockObjects[NULL_PEN];
384  }
385 
386 
387  if ((ulBrushStyle == BS_PATTERN) ||
388  (ulBrushStyle == BS_DIBPATTERN) ||
389  (ulBrushStyle == BS_DIBPATTERNPT))
390  {
391  ulColor = 0;
392  }
393  else if ((ulBrushStyle != BS_SOLID) &&
394  (ulBrushStyle != BS_HATCHED))
395  {
397  return 0;
398  }
399 
400  if ((dwPenStyle & PS_STYLE_MASK) != PS_USERSTYLE)
401  {
402  dwStyleCount = 0;
403  pUnsafeStyle = NULL;
404  }
405 
406  if (dwStyleCount > 0)
407  {
408  if (pUnsafeStyle == NULL)
409  {
411  return 0;
412  }
413 
414  pSafeStyle = ExAllocatePoolWithTag(NonPagedPool,
415  dwStyleCount * sizeof(DWORD),
417  if (!pSafeStyle)
418  {
420  return 0;
421  }
422  _SEH2_TRY
423  {
424  ProbeForRead(pUnsafeStyle, dwStyleCount * sizeof(DWORD), 1);
425  RtlCopyMemory(pSafeStyle,
426  pUnsafeStyle,
427  dwStyleCount * sizeof(DWORD));
428  }
430  {
432  }
433  _SEH2_END
434  if(!NT_SUCCESS(Status))
435  {
437  ExFreePoolWithTag(pSafeStyle, GDITAG_PENSTYLE);
438  return 0;
439  }
440  }
441 
442  if (ulBrushStyle == BS_PATTERN)
443  {
444  _SEH2_TRY
445  {
446  ProbeForRead((PVOID)ulHatch, cjDIB, 1);
447  }
449  {
451  }
452  _SEH2_END
453  if(!NT_SUCCESS(Status))
454  {
456  if (pSafeStyle) ExFreePoolWithTag(pSafeStyle, GDITAG_PENSTYLE);
457  return 0;
458  }
459  }
460 
461  hPen = IntGdiExtCreatePen(dwPenStyle,
462  ulWidth,
463  ulBrushStyle,
464  ulColor,
465  ulClientHatch,
466  ulHatch,
467  dwStyleCount,
468  pSafeStyle,
469  cjDIB,
470  bOldStylePen,
471  hBrush);
472 
473  if (!hPen && pSafeStyle)
474  {
475  ExFreePoolWithTag(pSafeStyle, GDITAG_PENSTYLE);
476  }
477 
478  return hPen;
479 }
#define GDITAG_PENSTYLE
Definition: tags.h:164
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define BS_DIBPATTERN
Definition: wingdi.h:1091
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define PS_STYLE_MASK
Definition: wingdi.h:600
LONG NTSTATUS
Definition: precomp.h:26
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define BS_NULL
Definition: wingdi.h:1086
_SEH2_TRY
Definition: create.c:4250
HGDIOBJ StockObjects[]
Definition: stockobj.c:100
#define NULL_PEN
Definition: wingdi.h:903
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
HPEN APIENTRY IntGdiExtCreatePen(DWORD dwPenStyle, DWORD dwWidth, IN ULONG ulBrushStyle, IN ULONG ulColor, IN ULONG_PTR ulClientHatch, IN ULONG_PTR ulHatch, DWORD dwStyleCount, PULONG pStyle, IN ULONG cjDIB, IN BOOL bOldStylePen, IN OPTIONAL HBRUSH hbrush)
Definition: pen.c:74
#define PS_COSMETIC
Definition: wingdi.h:583
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
VOID FASTCALL SetLastNtError(NTSTATUS Status)
Definition: error.c:36
Status
Definition: gdiplustypes.h:24
_SEH2_END
Definition: create.c:4424
#define PS_TYPE_MASK
Definition: wingdi.h:602
#define PS_NULL
Definition: wingdi.h:590
#define BS_PATTERN
Definition: wingdi.h:1089
#define BS_HATCHED
Definition: wingdi.h:1088
#define BS_SOLID
Definition: wingdi.h:1085
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define BS_DIBPATTERNPT
Definition: wingdi.h:1092
#define PS_USERSTYLE
Definition: wingdi.h:591
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27

◆ PEN_AllocExtPenWithHandle()

PBRUSH NTAPI PEN_AllocExtPenWithHandle ( VOID  )

Definition at line 44 of file pen.c.

46 {
47  PPEN ppen;
48 
50  if (ppen == NULL)
51  {
52  return NULL;
53  }
54 
55  PEN_vInit(ppen);
56  return ppen;
57 }
struct _BRUSH * PBRUSH
Definition: types.h:82
smooth NULL
Definition: ftsmooth.c:416
Definition: brush.hpp:15
static VOID PEN_vInit(PPEN ppen)
Definition: pen.c:18
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
Definition: gdiobj.c:1485

Referenced by IntGdiExtCreatePen().

◆ PEN_AllocPenWithHandle()

PBRUSH NTAPI PEN_AllocPenWithHandle ( VOID  )

Definition at line 27 of file pen.c.

29 {
30  PPEN ppen;
31 
33  if (ppen == NULL)
34  {
35  return NULL;
36  }
37 
38  PEN_vInit(ppen);
39  return ppen;
40 }
struct _BRUSH * PBRUSH
Definition: types.h:82
smooth NULL
Definition: ftsmooth.c:416
Definition: brush.hpp:15
static VOID PEN_vInit(PPEN ppen)
Definition: pen.c:18
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
Definition: gdiobj.c:1485

Referenced by IntCreateStockPen(), and IntGdiExtCreatePen().

◆ PEN_GetObject()

INT APIENTRY PEN_GetObject ( PBRUSH  pbrushPen,
INT  cbCount,
PLOGPEN  pBuffer 
)

Definition at line 255 of file pen.c.

256 {
257  PLOGPEN pLogPen;
258  PEXTLOGPEN pExtLogPen;
259  INT cbRetCount;
260 
261  if (pbrushPen->flAttrs & BR_IS_OLDSTYLEPEN)
262  {
263  cbRetCount = sizeof(LOGPEN);
264  if (pBuffer)
265  {
266  if (cbCount < cbRetCount) return 0;
267 
268  if (((pbrushPen->ulPenStyle & PS_STYLE_MASK) == PS_NULL) &&
269  (cbCount == sizeof(EXTLOGPEN)))
270  {
271  pExtLogPen = (PEXTLOGPEN)pBuffer;
272  pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
273  pExtLogPen->elpWidth = 0;
274  pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
275  pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
276  pExtLogPen->elpHatch = 0;
277  pExtLogPen->elpNumEntries = 0;
278  cbRetCount = sizeof(EXTLOGPEN);
279  }
280  else
281  {
282  pLogPen = (PLOGPEN)pBuffer;
283  pLogPen->lopnWidth.x = pbrushPen->lWidth;
284  pLogPen->lopnWidth.y = 0;
285  pLogPen->lopnStyle = pbrushPen->ulPenStyle;
286  pLogPen->lopnColor = pbrushPen->BrushAttr.lbColor;
287  }
288  }
289  }
290  else
291  {
292  DWORD dwStyleCount = (pbrushPen->flAttrs & BR_IS_DEFAULTSTYLE) ?
293  0 : pbrushPen->dwStyleCount;
294  cbRetCount = sizeof(EXTLOGPEN) - sizeof(DWORD) + dwStyleCount * sizeof(DWORD);
295  if (pBuffer)
296  {
297  ULONG i;
298 
299  if (cbCount < cbRetCount) return 0;
300  pExtLogPen = (PEXTLOGPEN)pBuffer;
301  pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
302  pExtLogPen->elpWidth = pbrushPen->lWidth;
303  pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
304  pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
305  pExtLogPen->elpHatch = (ULONG_PTR)pbrushPen->hbmClient;
306  pExtLogPen->elpNumEntries = dwStyleCount;
307  for (i = 0; i < dwStyleCount; i++)
308  {
309  pExtLogPen->elpStyleEntry[i] = pbrushPen->pStyle[i];
310  }
311  }
312  }
313 
314  return cbRetCount;
315 }
COLORREF elpColor
Definition: wingdi.h:1944
long y
Definition: polytest.cpp:48
static int cbCount
Definition: fiber.c:42
DWORD elpWidth
Definition: wingdi.h:1942
long x
Definition: polytest.cpp:48
#define PS_STYLE_MASK
Definition: wingdi.h:600
struct tagEXTLOGPEN EXTLOGPEN
POINT lopnWidth
Definition: wingdi.h:1845
ULONG_PTR elpHatch
Definition: wingdi.h:1945
#define DWORD
Definition: nt_native.h:44
int32_t INT
Definition: typedefs.h:56
DWORD elpNumEntries
Definition: wingdi.h:1946
struct tagLOGPEN * PLOGPEN
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define BR_IS_OLDSTYLEPEN
Definition: brush.h:104
DWORD elpStyleEntry[1]
Definition: wingdi.h:1947
DWORD elpPenStyle
Definition: wingdi.h:1941
UINT lopnStyle
Definition: wingdi.h:1844
COLORREF lopnColor
Definition: wingdi.h:1846
PVOID pBuffer
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
struct tagLOGPEN LOGPEN
struct tagEXTLOGPEN * PEXTLOGPEN
UINT elpBrushStyle
Definition: wingdi.h:1943
#define BR_IS_DEFAULTSTYLE
Definition: brush.h:107
#define PS_NULL
Definition: wingdi.h:590
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101

Referenced by GreGetObject().

◆ PEN_ShareLockPen()

PBRUSH FASTCALL PEN_ShareLockPen ( HPEN  hobj)

Definition at line 61 of file pen.c.

62 {
65  {
66  return NULL;
67  }
68 
70 }
POBJ NTAPI GDIOBJ_ReferenceObjectByHandle(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:688
smooth NULL
Definition: ftsmooth.c:416
Definition: types.h:100
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31

Referenced by DC_vInitDc(), DC_vSetOwner(), DC_vUpdateLineBrush(), IntArc(), IntGdiSetSolidPenColor(), IntRoundRect(), and NtGdiEllipse().

◆ PEN_vInit()

static VOID PEN_vInit ( PPEN  ppen)
static

Definition at line 18 of file pen.c.

20 {
21  /* Start with kmode brush attribute */
22  ppen->pBrushAttr = &ppen->BrushAttr;
23 }
BRUSH_ATTR * pBrushAttr
Definition: brush.h:22
BRUSH_ATTR BrushAttr
Definition: brush.h:23

Referenced by PEN_AllocExtPenWithHandle(), and PEN_AllocPenWithHandle().