ReactOS 0.4.15-dev-7934-g1dc8d80
line.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for line.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID FASTCALL AddPenLinesBounds (PDC dc, int count, POINT *points)
 
BOOL FASTCALL IntGdiMoveToEx (DC *dc, int X, int Y, LPPOINT Point)
 
BOOL FASTCALL GreMoveTo (HDC hdc, INT x, INT y, LPPOINT pptOut)
 
VOID FASTCALL IntGetCurrentPositionEx (PDC dc, LPPOINT pt)
 
BOOL FASTCALL IntGdiLineTo (DC *dc, int XEnd, int YEnd)
 
BOOL FASTCALL IntGdiPolyBezier (DC *dc, LPPOINT pt, DWORD Count)
 
BOOL FASTCALL IntGdiPolyBezierTo (DC *dc, LPPOINT pt, DWORD Count)
 
BOOL FASTCALL IntGdiPolyline (DC *dc, LPPOINT pt, int Count)
 
BOOL FASTCALL IntGdiPolylineTo (DC *dc, LPPOINT pt, DWORD Count)
 
BOOL FASTCALL IntGdiPolyPolyline (DC *dc, LPPOINT pt, PULONG PolyPoints, DWORD Count)
 
BOOL APIENTRY NtGdiLineTo (HDC hDC, int XEnd, int YEnd)
 
BOOL APIENTRY NtGdiPolyDraw (IN HDC hdc, IN LPPOINT lppt, IN LPBYTE lpbTypes, IN ULONG cCount)
 
 _Success_ (return !=FALSE)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file line.c.

Function Documentation

◆ _Success_()

_Success_ ( return = FALSE)

Definition at line 691 of file line.c.

699{
700 PDC pdc;
701 BOOL Ret;
702 POINT Point;
703
704 pdc = DC_LockDc(hdc);
705 if (!pdc) return FALSE;
706
707 Ret = IntGdiMoveToEx(pdc, x, y, &Point);
708
709 if (Ret && pptOut)
710 {
712 {
713 ProbeForWrite(pptOut, sizeof(POINT), 1);
714 RtlCopyMemory(pptOut, &Point, sizeof(POINT));
715 }
717 {
719 Ret = FALSE; // CHECKME: is this correct?
720 }
721 _SEH2_END;
722 }
723
724 DC_UnlockDc(pdc);
725
726 return Ret;
727}
FORCEINLINE VOID DC_UnlockDc(PDC pdc)
Definition: dc.h:238
FORCEINLINE PDC DC_LockDc(HDC hdc)
Definition: dc.h:220
#define FALSE
Definition: types.h:117
VOID NTAPI ProbeForWrite(IN PVOID Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:143
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
HDC hdc
Definition: main.c:9
_In_ UINT _Out_ PPOINTL pptOut
Definition: ntgdi.h:2198
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
Definition: polytest.cpp:41
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
VOID FASTCALL SetLastNtError(_In_ NTSTATUS Status)
Definition: error.c:31
BOOL FASTCALL IntGdiMoveToEx(DC *dc, int X, int Y, LPPOINT Point)
Definition: line.c:78

◆ AddPenLinesBounds()

VOID FASTCALL AddPenLinesBounds ( PDC  dc,
int  count,
POINT points 
)

Definition at line 17 of file line.c.

18{
19 DWORD join, endcap;
20 RECTL bounds, rect;
21 LONG lWidth;
22 PBRUSH pbrLine;
23
24 /* Get BRUSH from current pen. */
25 pbrLine = dc->dclevel.pbrLine;
26 ASSERT(pbrLine);
27
28 lWidth = 0;
29
30 // Setup bounds
31 bounds.left = bounds.top = INT_MAX;
32 bounds.right = bounds.bottom = INT_MIN;
33
34 if (((pbrLine->ulPenStyle & PS_TYPE_MASK) & PS_GEOMETRIC) || pbrLine->lWidth > 1)
35 {
36 /* Windows uses some heuristics to estimate the distance from the point that will be painted */
37 lWidth = pbrLine->lWidth + 2;
38 endcap = (PS_ENDCAP_MASK & pbrLine->ulPenStyle);
39 join = (PS_JOIN_MASK & pbrLine->ulPenStyle);
40 if (join == PS_JOIN_MITER)
41 {
42 lWidth *= 5;
43 if (endcap == PS_ENDCAP_SQUARE) lWidth = (lWidth * 3 + 1) / 2;
44 }
45 else
46 {
47 if (endcap == PS_ENDCAP_SQUARE) lWidth -= lWidth / 4;
48 else lWidth = (lWidth + 1) / 2;
49 }
50 }
51
52 while (count-- > 0)
53 {
54 rect.left = points->x - lWidth;
55 rect.top = points->y - lWidth;
56 rect.right = points->x + lWidth + 1;
57 rect.bottom = points->y + lWidth + 1;
58 RECTL_bUnionRect(&bounds, &bounds, &rect);
59 points++;
60 }
61
62 DPRINT("APLB dc %p l %d t %d\n",dc,rect.left,rect.top);
63 DPRINT(" r %d b %d\n",rect.right,rect.bottom);
64
65 {
66 RECTL rcRgn = dc->erclClip; // Use the clip box for now.
67
68 if (RECTL_bIntersectRect( &rcRgn, &rcRgn, &bounds ))
69 IntUpdateBoundsRect(dc, &rcRgn);
70 else
71 IntUpdateBoundsRect(dc, &bounds);
72 }
73}
VOID FASTCALL IntUpdateBoundsRect(PDC, PRECTL)
Definition: dcutil.c:694
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizei const GLfloat * points
Definition: glext.h:8112
#define INT_MIN
Definition: limits.h:39
#define INT_MAX
Definition: limits.h:40
static const WCHAR dc[]
LOCAL int join(int *aux, int a, int b)
Definition: match.c:560
#define ASSERT(a)
Definition: mode.c:44
long LONG
Definition: pedump.c:60
#define DPRINT
Definition: sndvol32.h:71
& rect
Definition: startmenu.cpp:1413
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
Definition: types.h:101
BOOL FASTCALL RECTL_bUnionRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:18
BOOL FASTCALL RECTL_bIntersectRect(_Out_ RECTL *prclDst, _In_ const RECTL *prcl1, _In_ const RECTL *prcl2)
Definition: rect.c:55
#define PS_ENDCAP_SQUARE
Definition: wingdi.h:595
#define PS_GEOMETRIC
Definition: wingdi.h:583
#define PS_JOIN_MASK
Definition: wingdi.h:600
#define PS_JOIN_MITER
Definition: wingdi.h:598
#define PS_ENDCAP_MASK
Definition: wingdi.h:602
#define PS_TYPE_MASK
Definition: wingdi.h:603

Referenced by IntGdiLineTo(), and IntGdiPolyline().

◆ GreMoveTo()

BOOL FASTCALL GreMoveTo ( HDC  hdc,
INT  x,
INT  y,
LPPOINT  pptOut 
)

Definition at line 108 of file line.c.

112{
113 BOOL Ret;
114 PDC dc;
115 if (!(dc = DC_LockDc(hdc)))
116 {
118 return FALSE;
119 }
120 Ret = IntGdiMoveToEx(dc, x, y, pptOut);
122 return Ret;
123}
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22

Referenced by IntDrawDiagEdge(), IntDrawMenuBarTemp(), IntDrawRectEdge(), MENU_DrawMenuItem(), NC_DoNCPaint(), TEXT_DrawUnderscore(), and UserDrawCaptionBar().

◆ IntGdiLineTo()

BOOL FASTCALL IntGdiLineTo ( DC dc,
int  XEnd,
int  YEnd 
)

Definition at line 146 of file line.c.

149{
150 SURFACE *psurf;
151 BOOL Ret = TRUE;
152 PBRUSH pbrLine;
153 RECTL Bounds;
154 POINT Points[2];
155 PDC_ATTR pdcattr;
156 PPATH pPath;
157
159
160 pdcattr = dc->pdcattr;
161
162 if (PATH_IsPathOpen(dc->dclevel))
163 {
164 Ret = PATH_LineTo(dc, XEnd, YEnd);
165 }
166 else
167 {
168 psurf = dc->dclevel.pSurface;
169 if (NULL == psurf)
170 {
172 return FALSE;
173 }
174
175 Points[0].x = pdcattr->ptlCurrent.x;
176 Points[0].y = pdcattr->ptlCurrent.y;
177 Points[1].x = XEnd;
178 Points[1].y = YEnd;
179
180 IntLPtoDP(dc, Points, 2);
181
182 /* The DCOrg is in device coordinates */
183 Points[0].x += dc->ptlDCOrig.x;
184 Points[0].y += dc->ptlDCOrig.y;
185 Points[1].x += dc->ptlDCOrig.x;
186 Points[1].y += dc->ptlDCOrig.y;
187
188 Bounds.left = min(Points[0].x, Points[1].x);
189 Bounds.top = min(Points[0].y, Points[1].y);
190 Bounds.right = max(Points[0].x, Points[1].x);
191 Bounds.bottom = max(Points[0].y, Points[1].y);
192
193 /* Get BRUSH from current pen. */
194 pbrLine = dc->dclevel.pbrLine;
195 ASSERT(pbrLine);
196
197 if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
198 {
199 DPRINT("Bounds dc %p l %d t %d\n",dc,Bounds.left,Bounds.top);
200 DPRINT(" r %d b %d\n",Bounds.right,Bounds.bottom);
201 AddPenLinesBounds(dc, 2, Points);
202 }
203
204 if (!(pbrLine->flAttrs & BR_IS_NULL))
205 {
206 if (IntIsEffectiveWidePen(pbrLine))
207 {
208 /* Clear the path */
209 PATH_Delete(dc->dclevel.hPath);
210 dc->dclevel.hPath = NULL;
211
212 /* Begin a path */
213 pPath = PATH_CreatePath(2);
214 dc->dclevel.flPath |= DCPATH_ACTIVE;
215 dc->dclevel.hPath = pPath->BaseObject.hHmgr;
217 IntLPtoDP(dc, &pPath->pos, 1);
218
219 PATH_MoveTo(dc, pPath);
220 PATH_LineTo(dc, XEnd, YEnd);
221
222 /* Close the path */
223 pPath->state = PATH_Closed;
224 dc->dclevel.flPath &= ~DCPATH_ACTIVE;
225
226 /* Actually stroke a path */
227 Ret = PATH_StrokePath(dc, pPath);
228
229 /* Clear the path */
230 PATH_UnlockPath(pPath);
231 PATH_Delete(dc->dclevel.hPath);
232 dc->dclevel.hPath = NULL;
233 }
234 else
235 {
236 Ret = IntEngLineTo(&psurf->SurfObj,
237 (CLIPOBJ *)&dc->co,
238 &dc->eboLine.BrushObject,
239 Points[0].x, Points[0].y,
240 Points[1].x, Points[1].y,
241 &Bounds,
242 ROP2_TO_MIX(pdcattr->jROP2));
243 }
244 }
245 }
246
247 if (Ret)
248 {
249 pdcattr->ptlCurrent.x = XEnd;
250 pdcattr->ptlCurrent.y = YEnd;
251 pdcattr->ptfxCurrent = pdcattr->ptlCurrent;
252 CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx
254 }
255
256 return Ret;
257}
HGDIOBJ hHmgr(VOID)
Definition: baseobj.hpp:95
#define CoordLPtoDP(pdc, ppt)
Definition: coord.h:187
static BOOLEAN IntLPtoDP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:182
#define ASSERT_DC_PREPARED(pdc)
Definition: dc.h:300
@ DC_ACCUM_APP
Definition: dc.h:25
@ DC_ACCUM_WMGR
Definition: dc.h:24
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define BR_IS_NULL
Definition: brush.h:105
#define ROP2_TO_MIX(Rop2)
Definition: inteng.h:40
#define min(a, b)
Definition: monoChain.cc:55
#define DIRTY_PTLCURRENT
Definition: ntgdihdl.h:131
#define DIRTY_STYLESTATE
Definition: ntgdihdl.h:133
#define DIRTY_PTFXCURRENT
Definition: ntgdihdl.h:132
#define PATH_UnlockPath(pPath)
Definition: path.h:71
#define PATH_IsPathOpen(dclevel)
Definition: path.h:72
@ PATH_Closed
Definition: path.h:20
@ DCPATH_ACTIVE
Definition: path.h:6
#define IntIsEffectiveWidePen(pbrLine)
Definition: pen.h:33
void IntEngLineTo(SURFOBJ *, CLIPOBJ, PBRUSHOBJ, int x1, int y1, int x2, int y2, RECTL *, MIX mix)
Definition: polytest.cpp:107
POINTL ptlCurrent
Definition: ntgdihdl.h:311
ULONG ulDirty_
Definition: ntgdihdl.h:294
POINTL ptfxCurrent
Definition: ntgdihdl.h:312
BYTE jROP2
Definition: ntgdihdl.h:307
Definition: path.h:35
POINT pos
Definition: path.h:58
BASEOBJECT BaseObject
Definition: path.h:36
FLONG state
Definition: path.h:52
LONG y
Definition: windef.h:330
LONG x
Definition: windef.h:329
SURFOBJ SurfObj
Definition: surface.h:8
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define max(a, b)
Definition: svc.c:63
VOID FASTCALL IntGetCurrentPositionEx(PDC dc, LPPOINT pt)
Definition: line.c:128
VOID FASTCALL AddPenLinesBounds(PDC dc, int count, POINT *points)
Definition: line.c:17
BOOL FASTCALL PATH_Delete(HPATH hPath)
Definition: path.c:90
BOOL FASTCALL PATH_LineTo(PDC dc, INT x, INT y)
Definition: path.c:583
BOOL FASTCALL PATH_StrokePath(DC *dc, PPATH pPath)
Definition: path.c:1597
PPATH FASTCALL PATH_CreatePath(int count)
Definition: path.c:35
BOOL FASTCALL PATH_MoveTo(PDC dc, PPATH pPath)
Definition: path.c:554

Referenced by IntGdiArcInternal(), and NtGdiLineTo().

◆ IntGdiMoveToEx()

BOOL FASTCALL IntGdiMoveToEx ( DC dc,
int  X,
int  Y,
LPPOINT  Point 
)

Definition at line 78 of file line.c.

82{
83 PDC_ATTR pdcattr = dc->pdcattr;
84 if ( Point )
85 {
86 if ( pdcattr->ulDirty_ & DIRTY_PTLCURRENT ) // Double hit!
87 {
88 Point->x = pdcattr->ptfxCurrent.x; // ret prev before change.
89 Point->y = pdcattr->ptfxCurrent.y;
90 IntDPtoLP ( dc, Point, 1); // Reconvert back.
91 }
92 else
93 {
94 Point->x = pdcattr->ptlCurrent.x;
95 Point->y = pdcattr->ptlCurrent.y;
96 }
97 }
98 pdcattr->ptlCurrent.x = X;
99 pdcattr->ptlCurrent.y = Y;
100 pdcattr->ptfxCurrent = pdcattr->ptlCurrent;
101 CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx
103
104 return TRUE;
105}
static BOOLEAN IntDPtoLP(DC *pdc, PPOINTL ppt, UINT count)
Definition: coord.h:192
#define Y(I)
#define X(b, s)

Referenced by _Success_(), add_log_points_new_stroke(), GreMoveTo(), IntGdiAngleArc(), IntGdiArcInternal(), NtGdiPolyDraw(), PATH_PolyDraw(), and PATH_StrokePath().

◆ IntGdiPolyBezier()

BOOL FASTCALL IntGdiPolyBezier ( DC dc,
LPPOINT  pt,
DWORD  Count 
)

Definition at line 260 of file line.c.

263{
264 BOOL ret = FALSE; // Default to FAILURE
265
266 if ( PATH_IsPathOpen(dc->dclevel) )
267 {
268 return PATH_PolyBezier ( dc, pt, Count );
269 }
270
271 /* We'll convert it into line segments and draw them using Polyline */
272 {
273 POINT *Pts;
274 INT nOut;
275
276 Pts = GDI_Bezier ( pt, Count, &nOut );
277 if ( Pts )
278 {
279 ret = IntGdiPolyline(dc, Pts, nOut);
281 }
282 }
283
284 return ret;
285}
POINT * GDI_Bezier(const POINT *Points, INT count, INT *nPtsOut)
Definition: bezier.c:189
#define pt(x, y)
Definition: drawing.c:79
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
int Count
Definition: noreturn.cpp:7
int32_t INT
Definition: typedefs.h:58
int ret
BOOL FASTCALL IntGdiPolyline(DC *dc, LPPOINT pt, int Count)
Definition: line.c:325
BOOL FASTCALL PATH_PolyBezier(PDC dc, const POINT *pts, DWORD cbPoints)
Definition: path.c:1154
#define TAG_BEZIER
Definition: tags.h:13

Referenced by IntGdiPolyBezierTo(), and NtGdiPolyPolyDraw().

◆ IntGdiPolyBezierTo()

BOOL FASTCALL IntGdiPolyBezierTo ( DC dc,
LPPOINT  pt,
DWORD  Count 
)

Definition at line 288 of file line.c.

291{
292 BOOL ret = FALSE; // Default to failure
293 PDC_ATTR pdcattr = dc->pdcattr;
294
295 if ( PATH_IsPathOpen(dc->dclevel) )
297 else /* We'll do it using PolyBezier */
298 {
299 POINT *npt;
301 sizeof(POINT) * (Count + 1),
302 TAG_BEZIER);
303 if ( npt )
304 {
305 npt[0].x = pdcattr->ptlCurrent.x;
306 npt[0].y = pdcattr->ptlCurrent.y;
307 memcpy(npt + 1, pt, sizeof(POINT) * Count);
308 ret = IntGdiPolyBezier(dc, npt, Count+1);
310 }
311 }
312 if ( ret )
313 {
314 pdcattr->ptlCurrent.x = pt[Count-1].x;
315 pdcattr->ptlCurrent.y = pt[Count-1].y;
316 pdcattr->ptfxCurrent = pdcattr->ptlCurrent;
317 CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx
319 }
320
321 return ret;
322}
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BOOL FASTCALL IntGdiPolyBezier(DC *dc, LPPOINT pt, DWORD Count)
Definition: line.c:260
BOOL FASTCALL PATH_PolyBezierTo(PDC dc, const POINT *pts, DWORD cbPoints)
Definition: path.c:1131

Referenced by NtGdiPolyPolyDraw().

◆ IntGdiPolyline()

BOOL FASTCALL IntGdiPolyline ( DC dc,
LPPOINT  pt,
int  Count 
)

Definition at line 325 of file line.c.

328{
329 SURFACE *psurf;
330 BRUSH *pbrLine;
331 LPPOINT Points;
332 BOOL Ret = TRUE;
333 LONG i;
334 PDC_ATTR pdcattr = dc->pdcattr;
335 PPATH pPath;
336
337 if (!dc->dclevel.pSurface)
338 {
339 return TRUE;
340 }
341
343 psurf = dc->dclevel.pSurface;
344
345 /* Get BRUSHOBJ from current pen. */
346 pbrLine = dc->dclevel.pbrLine;
347 ASSERT(pbrLine);
348
349 if (!(pbrLine->flAttrs & BR_IS_NULL))
350 {
351 Points = EngAllocMem(0, Count * sizeof(POINT), GDITAG_TEMP);
352 if (Points != NULL)
353 {
354 RtlCopyMemory(Points, pt, Count * sizeof(POINT));
355 IntLPtoDP(dc, Points, Count);
356
357 /* Offset the array of points by the DC origin */
358 for (i = 0; i < Count; i++)
359 {
360 Points[i].x += dc->ptlDCOrig.x;
361 Points[i].y += dc->ptlDCOrig.y;
362 }
363
364 if (dc->fs & (DC_ACCUM_APP|DC_ACCUM_WMGR))
365 {
366 AddPenLinesBounds(dc, Count, Points);
367 }
368
369 if (IntIsEffectiveWidePen(pbrLine))
370 {
371 /* Clear the path */
372 PATH_Delete(dc->dclevel.hPath);
373 dc->dclevel.hPath = NULL;
374
375 /* Begin a path */
376 pPath = PATH_CreatePath(Count);
377 dc->dclevel.flPath |= DCPATH_ACTIVE;
378 dc->dclevel.hPath = pPath->BaseObject.hHmgr;
379 pPath->pos = pt[0];
380 IntLPtoDP(dc, &pPath->pos, 1);
381
382 PATH_MoveTo(dc, pPath);
383 for (i = 1; i < Count; ++i)
384 {
385 PATH_LineTo(dc, pt[i].x, pt[i].y);
386 }
387
388 /* Close the path */
389 pPath->state = PATH_Closed;
390 dc->dclevel.flPath &= ~DCPATH_ACTIVE;
391
392 /* Actually stroke a path */
393 Ret = PATH_StrokePath(dc, pPath);
394
395 /* Clear the path */
396 PATH_UnlockPath(pPath);
397 PATH_Delete(dc->dclevel.hPath);
398 dc->dclevel.hPath = NULL;
399 }
400 else
401 {
402 Ret = IntEngPolyline(&psurf->SurfObj,
403 (CLIPOBJ *)&dc->co,
404 &dc->eboLine.BrushObject,
405 Points,
406 Count,
407 ROP2_TO_MIX(pdcattr->jROP2));
408 }
409 EngFreeMem(Points);
410 }
411 else
412 {
413 Ret = FALSE;
414 }
415 }
416
418
419 return Ret;
420}
Definition: brush.hpp:16
VOID FASTCALL DC_vPrepareDCsForBlit(PDC pdcDest, const RECT *rcDest, PDC pdcSrc, const RECT *rcSrc)
Definition: dclife.c:505
VOID FASTCALL DC_vFinishBlit(PDC pdc1, PDC pdc2)
Definition: dclife.c:614
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
BOOL APIENTRY IntEngPolyline(SURFOBJ *DestSurf, CLIPOBJ *Clip, BRUSHOBJ *Brush, CONST LPPOINT pt, LONG dCount, MIX mix)
Definition: lineto.c:703
#define EngFreeMem
Definition: polytest.cpp:56
void * EngAllocMem(int zero, unsigned long size, int tag=0)
Definition: polytest.cpp:70
ULONG flAttrs
Definition: brush.h:19
#define GDITAG_TEMP
Definition: tags.h:167

Referenced by IntGdiPolyBezier(), IntGdiPolylineTo(), IntGdiPolyPolyline(), NtGdiPolyDraw(), and PATH_StrokePath().

◆ IntGdiPolylineTo()

BOOL FASTCALL IntGdiPolylineTo ( DC dc,
LPPOINT  pt,
DWORD  Count 
)

Definition at line 423 of file line.c.

426{
427 BOOL ret = FALSE; // Default to failure
428 PDC_ATTR pdcattr = dc->pdcattr;
429
430 if (PATH_IsPathOpen(dc->dclevel))
431 {
433 }
434 else /* Do it using Polyline */
435 {
437 sizeof(POINT) * (Count + 1),
438 TAG_SHAPE);
439 if ( pts )
440 {
441 pts[0].x = pdcattr->ptlCurrent.x;
442 pts[0].y = pdcattr->ptlCurrent.y;
443 memcpy( pts + 1, pt, sizeof(POINT) * Count);
444 ret = IntGdiPolyline(dc, pts, Count + 1);
446 }
447 }
448 if ( ret )
449 {
450 pdcattr->ptlCurrent.x = pt[Count-1].x;
451 pdcattr->ptlCurrent.y = pt[Count-1].y;
452 pdcattr->ptfxCurrent = pdcattr->ptlCurrent;
453 CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx
455 }
456
457 return ret;
458}
BOOL FASTCALL PATH_PolylineTo(PDC dc, const POINT *pts, DWORD cbPoints)
Definition: path.c:1264
#define TAG_SHAPE
Definition: tags.h:14

Referenced by NtGdiPolyPolyDraw().

◆ IntGdiPolyPolyline()

BOOL FASTCALL IntGdiPolyPolyline ( DC dc,
LPPOINT  pt,
PULONG  PolyPoints,
DWORD  Count 
)

Definition at line 462 of file line.c.

466{
467 ULONG i;
468 LPPOINT pts;
469 PULONG pc;
470 BOOL ret = FALSE; // Default to failure
471 pts = pt;
472 pc = PolyPoints;
473
474 if (PATH_IsPathOpen(dc->dclevel))
475 {
476 return PATH_PolyPolyline( dc, pt, PolyPoints, Count );
477 }
478 for (i = 0; i < Count; i++)
479 {
480 ret = IntGdiPolyline ( dc, pts, *pc );
481 if (ret == FALSE)
482 {
483 return ret;
484 }
485 pts+=*pc++;
486 }
487
488 return ret;
489}
uint32_t * PULONG
Definition: typedefs.h:59
uint32_t ULONG
Definition: typedefs.h:59
BOOL FASTCALL PATH_PolyPolyline(PDC dc, const POINT *pts, const DWORD *counts, DWORD polylines)
Definition: path.c:1338

Referenced by NtGdiPolyPolyDraw().

◆ IntGetCurrentPositionEx()

VOID FASTCALL IntGetCurrentPositionEx ( PDC  dc,
LPPOINT  pt 
)

Definition at line 128 of file line.c.

129{
130 PDC_ATTR pdcattr = dc->pdcattr;
131
132 if ( pt )
133 {
134 if (pdcattr->ulDirty_ & DIRTY_PTFXCURRENT)
135 {
136 pdcattr->ptfxCurrent = pdcattr->ptlCurrent;
137 CoordLPtoDP(dc, &pdcattr->ptfxCurrent); // Update fx
139 }
140 pt->x = pdcattr->ptlCurrent.x;
141 pt->y = pdcattr->ptlCurrent.y;
142 }
143}

Referenced by IntGdiLineTo(), NtGdiBeginPath(), PATH_Arc(), PATH_LineTo(), PATH_MoveTo(), PATH_PolyDraw(), and PATH_StrokePath().

◆ NtGdiLineTo()

BOOL APIENTRY NtGdiLineTo ( HDC  hDC,
int  XEnd,
int  YEnd 
)

Definition at line 495 of file line.c.

498{
499 DC *dc;
500 BOOL Ret;
501 RECT rcLockRect ;
502
503 dc = DC_LockDc(hDC);
504 if (!dc)
505 {
507 return FALSE;
508 }
509
510 rcLockRect.left = dc->pdcattr->ptlCurrent.x;
511 rcLockRect.top = dc->pdcattr->ptlCurrent.y;
512 rcLockRect.right = XEnd;
513 rcLockRect.bottom = YEnd;
514
515 IntLPtoDP(dc, (PPOINT)&rcLockRect, 2);
516
517 /* The DCOrg is in device coordinates */
518 rcLockRect.left += dc->ptlDCOrig.x;
519 rcLockRect.top += dc->ptlDCOrig.y;
520 rcLockRect.right += dc->ptlDCOrig.x;
521 rcLockRect.bottom += dc->ptlDCOrig.y;
522
523 DC_vPrepareDCsForBlit(dc, &rcLockRect, NULL, NULL);
524
525 Ret = IntGdiLineTo(dc, XEnd, YEnd);
526
528
530 return Ret;
531}
static HDC hDC
Definition: 3dtext.c:33
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
BOOL FASTCALL IntGdiLineTo(DC *dc, int XEnd, int YEnd)
Definition: line.c:146

◆ NtGdiPolyDraw()

BOOL APIENTRY NtGdiPolyDraw ( IN HDC  hdc,
IN LPPOINT  lppt,
IN LPBYTE  lpbTypes,
IN ULONG  cCount 
)

Definition at line 536 of file line.c.

541{
542 PDC dc;
543 PDC_ATTR pdcattr;
544 POINT bzr[4];
545 volatile PPOINT line_pts, line_pts_old, bzr_pts;
546 INT num_pts, num_bzr_pts, space, space_old, size;
547 ULONG i;
548 BOOL result = FALSE;
549
550 dc = DC_LockDc(hdc);
551 if (!dc) return FALSE;
552 pdcattr = dc->pdcattr;
553
554 if (pdcattr->ulDirty_ & (DIRTY_FILL | DC_BRUSH_DIRTY))
556
557 if (pdcattr->ulDirty_ & (DIRTY_LINE | DC_PEN_DIRTY))
559
560 if (!cCount)
561 {
563 return TRUE;
564 }
565
566 line_pts = NULL;
567 line_pts_old = NULL;
568 bzr_pts = NULL;
569
571 {
572 ProbeArrayForRead(lppt, sizeof(POINT), cCount, sizeof(LONG));
573 ProbeArrayForRead(lpbTypes, sizeof(BYTE), cCount, sizeof(BYTE));
574
575 if (PATH_IsPathOpen(dc->dclevel))
576 {
577 result = PATH_PolyDraw(dc, (const POINT *)lppt, (const BYTE *)lpbTypes, cCount);
579 }
580
581 /* Check for valid point types */
582 for (i = 0; i < cCount; i++)
583 {
584 switch (lpbTypes[i])
585 {
586 case PT_MOVETO:
588 case PT_LINETO:
589 break;
590 case PT_BEZIERTO:
591 if((i + 2 < cCount) && (lpbTypes[i + 1] == PT_BEZIERTO) &&
592 ((lpbTypes[i + 2] & ~PT_CLOSEFIGURE) == PT_BEZIERTO))
593 {
594 i += 2;
595 break;
596 }
597 default:
599 }
600 }
601
602 space = cCount + 300;
603 line_pts = ExAllocatePoolWithTag(PagedPool, space * sizeof(POINT), TAG_SHAPE);
604 if (line_pts == NULL)
605 {
606 result = FALSE;
608 }
609
610 num_pts = 1;
611
612 line_pts[0].x = pdcattr->ptlCurrent.x;
613 line_pts[0].y = pdcattr->ptlCurrent.y;
614
615 for ( i = 0; i < cCount; i++ )
616 {
617 switch (lpbTypes[i])
618 {
619 case PT_MOVETO:
620 if (num_pts >= 2) IntGdiPolyline( dc, line_pts, num_pts );
621 num_pts = 0;
622 line_pts[num_pts++] = lppt[i];
623 break;
624 case PT_LINETO:
625 case (PT_LINETO | PT_CLOSEFIGURE):
626 line_pts[num_pts++] = lppt[i];
627 break;
628 case PT_BEZIERTO:
629 bzr[0].x = line_pts[num_pts - 1].x;
630 bzr[0].y = line_pts[num_pts - 1].y;
631 RtlCopyMemory( &bzr[1], &lppt[i], 3 * sizeof(POINT) );
632
633 if ((bzr_pts = GDI_Bezier( bzr, 4, &num_bzr_pts )))
634 {
635 size = num_pts + (cCount - i) + num_bzr_pts;
636 if (space < size)
637 {
638 space_old = space;
639 space = size * 2;
640 line_pts_old = line_pts;
641 line_pts = ExAllocatePoolWithTag(PagedPool, space * sizeof(POINT), TAG_SHAPE);
642 if (!line_pts) _SEH2_LEAVE;
643 RtlCopyMemory(line_pts, line_pts_old, space_old * sizeof(POINT));
644 ExFreePoolWithTag(line_pts_old, TAG_SHAPE);
645 line_pts_old = NULL;
646 }
647 RtlCopyMemory( &line_pts[num_pts], &bzr_pts[1], (num_bzr_pts - 1) * sizeof(POINT) );
648 num_pts += num_bzr_pts - 1;
650 bzr_pts = NULL;
651 }
652 i += 2;
653 break;
654 }
655 if (lpbTypes[i] & PT_CLOSEFIGURE) line_pts[num_pts++] = line_pts[0];
656 }
657
658 if (num_pts >= 2) IntGdiPolyline( dc, line_pts, num_pts );
659 IntGdiMoveToEx( dc, line_pts[num_pts - 1].x, line_pts[num_pts - 1].y, NULL );
660 result = TRUE;
661 }
663 {
665 }
666 _SEH2_END;
667
668 if (line_pts != NULL)
669 {
670 ExFreePoolWithTag(line_pts, TAG_SHAPE);
671 }
672
673 if ((line_pts_old != NULL) && (line_pts_old != line_pts))
674 {
675 ExFreePoolWithTag(line_pts_old, TAG_SHAPE);
676 }
677
678 if (bzr_pts != NULL)
679 {
681 }
682
684
685 return result;
686}
VOID FASTCALL DC_vUpdateLineBrush(PDC pdc)
Definition: dcobjs.c:62
VOID FASTCALL DC_vUpdateFillBrush(PDC pdc)
Definition: dcobjs.c:16
#define _SEH2_LEAVE
Definition: filesup.c:20
GLsizeiptr size
Definition: glext.h:5919
GLuint64EXT * result
Definition: glext.h:11304
#define DIRTY_FILL
Definition: ntgdihdl.h:123
#define DC_PEN_DIRTY
Definition: ntgdihdl.h:136
#define DIRTY_LINE
Definition: ntgdihdl.h:124
#define DC_BRUSH_DIRTY
Definition: ntgdihdl.h:135
BOOL FASTCALL PATH_PolyDraw(PDC dc, const POINT *pts, const BYTE *types, DWORD cbPoints)
Definition: path.c:1180
#define PT_LINETO
Definition: wingdi.h:885
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define PT_MOVETO
Definition: wingdi.h:884
#define PT_BEZIERTO
Definition: wingdi.h:886
unsigned char BYTE
Definition: xxhash.c:193