ReactOS 0.4.15-dev-7968-g24a56f8
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
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
119 hPen = pbrushPen->BaseObject.hHmgr;
120
121 if (bOldStylePen)
122 {
123 // If nWidth is zero, the pen is a single pixel wide, regardless of the current transformation.
124 if (!dwWidth && (dwPenStyle & PS_STYLE_MASK) != PS_SOLID)
125 dwWidth = 1;
126 }
127 else
128 {
129 switch (dwPenStyle & PS_ENDCAP_MASK)
130 {
131 case PS_ENDCAP_ROUND:
132 case PS_ENDCAP_SQUARE:
133 case PS_ENDCAP_FLAT:
134 break;
135
136 default:
137 goto ExitCleanup;
138 }
139
140 switch (dwPenStyle & PS_JOIN_MASK)
141 {
142 case PS_JOIN_ROUND:
143 case PS_JOIN_BEVEL:
144 case PS_JOIN_MITER:
145 break;
146
147 default:
148 goto ExitCleanup;
149 }
150
151 switch (dwPenStyle & PS_TYPE_MASK)
152 {
153 case PS_COSMETIC:
154 if (dwWidth != 1 || ulBrushStyle != BS_SOLID)
155 goto ExitCleanup;
156
157 break;
158
159 case PS_GEOMETRIC:
160 break;
161
162 default:
163 goto ExitCleanup;
164 }
165 }
166
167 pbrushPen->lWidth = dwWidth;
168 FLOATOBJ_SetLong(&pbrushPen->eWidth, pbrushPen->lWidth);
169 pbrushPen->ulPenStyle = dwPenStyle;
170 pbrushPen->BrushAttr.lbColor = ulColor;
171 pbrushPen->iBrushStyle = ulBrushStyle;
172 // FIXME: Copy the bitmap first ?
173 pbrushPen->hbmClient = (HANDLE)ulClientHatch;
174 pbrushPen->dwStyleCount = 0;
175 pbrushPen->pStyle = NULL;
176 pbrushPen->ulStyleSize = 0;
177 pbrushPen->flAttrs = bOldStylePen ? BR_IS_OLDSTYLEPEN : BR_IS_PEN;
178
179 switch (dwPenStyle & PS_STYLE_MASK)
180 {
181 case PS_NULL:
182 pbrushPen->flAttrs |= BR_IS_NULL;
183 break;
184
185 case PS_SOLID:
186 pbrushPen->flAttrs |= BR_IS_SOLID;
187 break;
188
189 case PS_ALTERNATE:
190 pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
191 pbrushPen->pStyle = aulStyleAlternate;
192 pbrushPen->dwStyleCount = _countof(aulStyleAlternate);
193 break;
194
195 case PS_DOT:
196 pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
197 pbrushPen->pStyle = aulStyleDot;
198 pbrushPen->dwStyleCount = _countof(aulStyleDot);
199 break;
200
201 case PS_DASH:
202 pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
203 pbrushPen->pStyle = aulStyleDash;
204 pbrushPen->dwStyleCount = _countof(aulStyleDash);
205 break;
206
207 case PS_DASHDOT:
208 pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
209 pbrushPen->pStyle = aulStyleDashDot;
210 pbrushPen->dwStyleCount = _countof(aulStyleDashDot);
211 break;
212
213 case PS_DASHDOTDOT:
214 pbrushPen->flAttrs |= BR_IS_SOLID | BR_IS_DEFAULTSTYLE;
215 pbrushPen->pStyle = aulStyleDashDotDot;
216 pbrushPen->dwStyleCount = _countof(aulStyleDashDotDot);
217 break;
218
219 case PS_INSIDEFRAME:
220 pbrushPen->flAttrs |= (BR_IS_SOLID | BR_IS_INSIDEFRAME);
221 break;
222
223 case PS_USERSTYLE:
224 {
225 UINT i;
226 BOOL has_neg = FALSE, all_zero = TRUE;
227
228 for(i = 0; (i < dwStyleCount) && !has_neg; i++)
229 {
230 has_neg = has_neg || (((INT)(pStyle[i])) < 0);
231 all_zero = all_zero && (pStyle[i] == 0);
232 }
233
234 if(all_zero || has_neg)
235 {
236 goto ExitCleanup;
237 }
238 }
239 /* FIXME: What style here? */
240 pbrushPen->flAttrs |= BR_IS_SOLID;
241 pbrushPen->dwStyleCount = dwStyleCount;
242 pbrushPen->pStyle = pStyle;
243 break;
244
245 default:
246 DPRINT1("IntGdiExtCreatePen unknown penstyle %x\n", dwPenStyle);
247 goto ExitCleanup;
248 }
249
250 if (pbrushPen->pStyle != NULL)
251 {
252 for (i = 0; i < pbrushPen->dwStyleCount; i++)
253 {
254 pbrushPen->ulStyleSize += pbrushPen->pStyle[i];
255 }
256 }
257
258 NT_ASSERT((pbrushPen->dwStyleCount == 0) || (pbrushPen->pStyle != NULL));
259
260 PEN_UnlockPen(pbrushPen);
261 return hPen;
262
263ExitCleanup:
265 pbrushPen->pStyle = NULL;
266 GDIOBJ_vDeleteObject(&pbrushPen->BaseObject);
267
268 return NULL;
269}
#define DPRINT1
Definition: precomp.h:8
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR dwWidth[]
Definition: provider.c:62
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define abs(i)
Definition: fconv.c:206
unsigned int BOOL
Definition: ntddk_ex.h:94
#define BR_IS_SOLID
Definition: brush.h:101
#define BR_IS_OLDSTYLEPEN
Definition: brush.h:108
#define BR_IS_INSIDEFRAME
Definition: brush.h:113
#define BR_IS_DEFAULTSTYLE
Definition: brush.h:111
#define BR_IS_NULL
Definition: brush.h:105
#define BR_IS_PEN
Definition: brush.h:107
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
unsigned int UINT
Definition: ndis.h:50
#define PEN_UnlockPen(pPenObj)
Definition: pen.h:17
#define INT
Definition: polytest.cpp:20
#define DPRINT
Definition: sndvol32.h:71
#define _countof(array)
Definition: sndvol32.h:68
Definition: types.h:101
BASEOBJECT BaseObject
Definition: brush.h:56
PVOID HANDLE
Definition: typedefs.h:73
uint32_t ULONG
Definition: typedefs.h:59
VOID NTAPI GDIOBJ_vDeleteObject(POBJ pobj)
Definition: gdiobj.c:1111
HGDIOBJ StockObjects[]
Definition: stockobj.c:100
PBRUSH NTAPI PEN_AllocExtPenWithHandle(VOID)
Definition: pen.c:44
PBRUSH NTAPI PEN_AllocPenWithHandle(VOID)
Definition: pen.c:27
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
#define FLOATOBJ_SetLong(pf, l)
Definition: winddi.h:2815
#define PS_NULL
Definition: wingdi.h:591
#define PS_DASH
Definition: wingdi.h:587
#define PS_ALTERNATE
Definition: wingdi.h:585
#define PS_JOIN_BEVEL
Definition: wingdi.h:597
#define PS_ENDCAP_SQUARE
Definition: wingdi.h:595
#define PS_DOT
Definition: wingdi.h:588
#define PS_JOIN_ROUND
Definition: wingdi.h:599
#define PS_COSMETIC
Definition: wingdi.h:584
#define PS_STYLE_MASK
Definition: wingdi.h:601
#define PS_ENDCAP_ROUND
Definition: wingdi.h:594
#define PS_GEOMETRIC
Definition: wingdi.h:583
#define PS_USERSTYLE
Definition: wingdi.h:592
#define PS_JOIN_MASK
Definition: wingdi.h:600
#define NULL_PEN
Definition: wingdi.h:904
#define PS_JOIN_MITER
Definition: wingdi.h:598
#define PS_INSIDEFRAME
Definition: wingdi.h:593
#define BS_SOLID
Definition: wingdi.h:1086
#define PS_ENDCAP_MASK
Definition: wingdi.h:602
#define PS_SOLID
Definition: wingdi.h:586
#define PS_TYPE_MASK
Definition: wingdi.h:603
#define PS_DASHDOT
Definition: wingdi.h:589
#define PS_ENDCAP_FLAT
Definition: wingdi.h:596
#define PS_DASHDOTDOT
Definition: wingdi.h:590
#define NT_ASSERT
Definition: rtlfuncs.h:3310

Referenced by NtGdiCreatePen(), and NtGdiExtCreatePen().

◆ IntGdiSetSolidPenColor()

VOID FASTCALL IntGdiSetSolidPenColor ( HPEN  hPen,
COLORREF  Color 
)

Definition at line 273 of file pen.c.

274{
275 PBRUSH pbrPen;
276
277 pbrPen = PEN_ShareLockPen(hPen);
278 if (pbrPen)
279 {
280 if (pbrPen->flAttrs & BR_IS_SOLID)
281 {
282 pbrPen->BrushAttr.lbColor = Color & 0xFFFFFF;
283 }
284 PEN_ShareUnlockPen(pbrPen);
285 }
286}
#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 357 of file pen.c.

362{
363 if ((PenStyle < PS_SOLID) ||( PenStyle > PS_INSIDEFRAME))
364 {
366 return NULL;
367 }
368
369 return IntGdiExtCreatePen(PenStyle,
370 Width,
371 BS_SOLID,
372 Color,
373 0,
374 0,
375 0,
376 NULL,
377 0,
378 TRUE,
379 hbr);
380}
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
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

◆ 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 384 of file pen.c.

396{
398 DWORD* pSafeStyle = NULL;
399 HPEN hPen;
400
401 if ((int)dwStyleCount < 0) return 0;
402 if (dwStyleCount > 16)
403 {
405 return 0;
406 }
407
408 if (((dwPenStyle & PS_TYPE_MASK) == PS_COSMETIC) &&
409 (ulBrushStyle != BS_SOLID))
410 {
412 return 0;
413 }
414
415 if (((dwPenStyle & PS_STYLE_MASK) == PS_NULL) ||
416 (ulBrushStyle == BS_NULL))
417 {
418 return StockObjects[NULL_PEN];
419 }
420
421
422 if ((ulBrushStyle == BS_PATTERN) ||
423 (ulBrushStyle == BS_DIBPATTERN) ||
424 (ulBrushStyle == BS_DIBPATTERNPT))
425 {
426 ulColor = 0;
427 }
428 else if ((ulBrushStyle != BS_SOLID) &&
429 (ulBrushStyle != BS_HATCHED))
430 {
432 return 0;
433 }
434
435 if ((dwPenStyle & PS_STYLE_MASK) != PS_USERSTYLE)
436 {
437 dwStyleCount = 0;
438 pUnsafeStyle = NULL;
439 }
440
441 if (dwStyleCount > 0)
442 {
443 if (pUnsafeStyle == NULL)
444 {
446 return 0;
447 }
448
450 dwStyleCount * sizeof(DWORD),
452 if (!pSafeStyle)
453 {
455 return 0;
456 }
458 {
459 ProbeForRead(pUnsafeStyle, dwStyleCount * sizeof(DWORD), 1);
460 RtlCopyMemory(pSafeStyle,
461 pUnsafeStyle,
462 dwStyleCount * sizeof(DWORD));
463 }
465 {
467 }
469 if(!NT_SUCCESS(Status))
470 {
473 return 0;
474 }
475 }
476
477 if (ulBrushStyle == BS_PATTERN)
478 {
480 {
481 ProbeForRead((PVOID)ulHatch, cjDIB, 1);
482 }
484 {
486 }
488 if(!NT_SUCCESS(Status))
489 {
491 if (pSafeStyle) ExFreePoolWithTag(pSafeStyle, GDITAG_PENSTYLE);
492 return 0;
493 }
494 }
495
496 hPen = IntGdiExtCreatePen(dwPenStyle,
497 ulWidth,
498 ulBrushStyle,
499 ulColor,
500 ulClientHatch,
501 ulHatch,
502 dwStyleCount,
503 pSafeStyle,
504 cjDIB,
505 bOldStylePen,
506 hBrush);
507
508 if (!hPen && pSafeStyle)
509 {
511 }
512
513 return hPen;
514}
LONG NTSTATUS
Definition: precomp.h:26
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define NonPagedPool
Definition: env_spec_w32.h:307
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define STATUS_SUCCESS
Definition: shellext.h:65
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
#define GDITAG_PENSTYLE
Definition: tags.h:165
#define BS_HATCHED
Definition: wingdi.h:1089
#define BS_PATTERN
Definition: wingdi.h:1090
#define BS_DIBPATTERNPT
Definition: wingdi.h:1093
#define BS_DIBPATTERN
Definition: wingdi.h:1092
#define BS_NULL
Definition: wingdi.h:1087

◆ 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}
Definition: brush.hpp:16
struct _BRUSH * PBRUSH
@ GDILoObjType_LO_EXTPEN_TYPE
Definition: gdi_private.h:45
Definition: types.h:83
POBJ NTAPI GDIOBJ_AllocObjWithHandle(ULONG ObjectType, ULONG cjSize)
Definition: gdiobj.c:1522
static VOID PEN_vInit(PPEN ppen)
Definition: pen.c:18

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}
@ GDILoObjType_LO_PEN_TYPE
Definition: gdi_private.h:44

Referenced by IntCreateStockPen(), and IntGdiExtCreatePen().

◆ PEN_GetObject()

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

Definition at line 290 of file pen.c.

291{
292 PLOGPEN pLogPen;
293 PEXTLOGPEN pExtLogPen;
294 INT cbRetCount;
295
296 if (pbrushPen->flAttrs & BR_IS_OLDSTYLEPEN)
297 {
298 cbRetCount = sizeof(LOGPEN);
299 if (pBuffer)
300 {
301 if (cbCount < cbRetCount) return 0;
302
303 if (((pbrushPen->ulPenStyle & PS_STYLE_MASK) == PS_NULL) &&
304 (cbCount == sizeof(EXTLOGPEN)))
305 {
306 pExtLogPen = (PEXTLOGPEN)pBuffer;
307 pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
308 pExtLogPen->elpWidth = 0;
309 pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
310 pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
311 pExtLogPen->elpHatch = 0;
312 pExtLogPen->elpNumEntries = 0;
313 cbRetCount = sizeof(EXTLOGPEN);
314 }
315 else
316 {
317 pLogPen = (PLOGPEN)pBuffer;
318 pLogPen->lopnWidth.x = pbrushPen->lWidth;
319 pLogPen->lopnWidth.y = 0;
320 pLogPen->lopnStyle = pbrushPen->ulPenStyle;
321 pLogPen->lopnColor = pbrushPen->BrushAttr.lbColor;
322 }
323 }
324 }
325 else
326 {
327 DWORD dwStyleCount = (pbrushPen->flAttrs & BR_IS_DEFAULTSTYLE) ?
328 0 : pbrushPen->dwStyleCount;
329 cbRetCount = sizeof(EXTLOGPEN) - sizeof(DWORD) + dwStyleCount * sizeof(DWORD);
330 if (pBuffer)
331 {
332 ULONG i;
333
334 if (cbCount < cbRetCount) return 0;
335 pExtLogPen = (PEXTLOGPEN)pBuffer;
336 pExtLogPen->elpPenStyle = pbrushPen->ulPenStyle;
337 pExtLogPen->elpWidth = pbrushPen->lWidth;
338 pExtLogPen->elpBrushStyle = pbrushPen->iBrushStyle;
339 pExtLogPen->elpColor = pbrushPen->BrushAttr.lbColor;
340 pExtLogPen->elpHatch = (ULONG_PTR)pbrushPen->hbmClient;
341 pExtLogPen->elpNumEntries = dwStyleCount;
342 for (i = 0; i < dwStyleCount; i++)
343 {
344 pExtLogPen->elpStyleEntry[i] = pbrushPen->pStyle[i];
345 }
346 }
347 }
348
349 return cbRetCount;
350}
#define ULONG_PTR
Definition: config.h:101
#define for
Definition: utility.h:88
static int cbCount
Definition: fiber.c:42
#define DWORD
Definition: nt_native.h:44
PVOID pBuffer
DWORD elpNumEntries
Definition: wingdi.h:1947
DWORD elpWidth
Definition: wingdi.h:1943
DWORD elpPenStyle
Definition: wingdi.h:1942
UINT elpBrushStyle
Definition: wingdi.h:1944
DWORD elpStyleEntry[1]
Definition: wingdi.h:1948
ULONG_PTR elpHatch
Definition: wingdi.h:1946
COLORREF elpColor
Definition: wingdi.h:1945
COLORREF lopnColor
Definition: wingdi.h:1847
POINT lopnWidth
Definition: wingdi.h:1846
UINT lopnStyle
Definition: wingdi.h:1845
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
int32_t INT
Definition: typedefs.h:58
struct tagLOGPEN LOGPEN
struct tagEXTLOGPEN EXTLOGPEN
struct tagEXTLOGPEN * PEXTLOGPEN
struct tagLOGPEN * PLOGPEN

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}
#define GDI_HANDLE_GET_TYPE(h)
Definition: gdi.h:31
@ GDIObjType_BRUSH_TYPE
Definition: ntgdityp.h:136
POBJ NTAPI GDIOBJ_ReferenceObjectByHandle(HGDIOBJ hobj, UCHAR objt)
Definition: gdiobj.c:691

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 BrushAttr
Definition: brush.h:23
BRUSH_ATTR * pBrushAttr
Definition: brush.h:22

Referenced by PEN_AllocExtPenWithHandle(), and PEN_AllocPenWithHandle().