ReactOS 0.4.16-dev-1946-g52006dd
lineto.c File Reference
#include <win32k.h>
#include <debug.h>
Include dependency graph for lineto.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

static void FASTCALL TranslateRects (RECT_ENUM *RectEnum, POINTL *Translate)
 
LONG HandleStyles (BRUSHOBJ *pbo, POINTL *Translate, LONG x, LONG y, LONG deltax, LONG deltay, LONG dx, LONG dy, PULONG piStyle)
 
void FASTCALL NWtoSE (SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
 
void FASTCALL SWtoNE (SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
 
void FASTCALL NEtoSW (SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
 
void FASTCALL SEtoNW (SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
 
BOOL APIENTRY EngLineTo (_Inout_ SURFOBJ *DestObj, _In_ CLIPOBJ *Clip, _In_ BRUSHOBJ *pbo, _In_ LONG x1, _In_ LONG y1, _In_ LONG x2, _In_ LONG y2, _In_opt_ RECTL *RectBounds, _In_ MIX mix)
 
BOOL APIENTRY IntEngLineTo (SURFOBJ *psoDest, CLIPOBJ *ClipObj, BRUSHOBJ *pbo, LONG x1, LONG y1, LONG x2, LONG y2, RECTL *RectBounds, MIX Mix)
 
BOOL APIENTRY IntEngPolyline (SURFOBJ *psoDest, CLIPOBJ *Clip, BRUSHOBJ *pbo, CONST LPPOINT pt, LONG dCount, MIX Mix)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file lineto.c.

Function Documentation

◆ EngLineTo()

BOOL APIENTRY EngLineTo ( _Inout_ SURFOBJ DestObj,
_In_ CLIPOBJ Clip,
_In_ BRUSHOBJ pbo,
_In_ LONG  x1,
_In_ LONG  y1,
_In_ LONG  x2,
_In_ LONG  y2,
_In_opt_ RECTL RectBounds,
_In_ MIX  mix 
)

Definition at line 448 of file lineto.c.

458{
459 LONG x, y, deltax, deltay, xchange, ychange, hx, vy;
460 ULONG i;
461 ULONG Pixel = pbo->iSolidColor;
462 SURFOBJ *OutputObj;
463 RECTL DestRect;
464 POINTL Translate;
465 INTENG_ENTER_LEAVE EnterLeave;
466 RECT_ENUM RectEnum;
467 BOOL EnumMore;
468 CLIPOBJ *pcoPriv = NULL;
469 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
470 ULONG cStyles = pebo->pbrush->dwStyleCount;
471
472 if (x1 < x2)
473 {
474 DestRect.left = x1;
475 DestRect.right = x2;
476 }
477 else
478 {
479 DestRect.left = x2;
480 DestRect.right = x1 + 1;
481 }
482 if (y1 < y2)
483 {
484 DestRect.top = y1;
485 DestRect.bottom = y2;
486 }
487 else
488 {
489 DestRect.top = y2;
490 DestRect.bottom = y1 + 1;
491 }
492
493 if (! IntEngEnter(&EnterLeave, DestObj, &DestRect, FALSE, &Translate, &OutputObj))
494 {
495 return FALSE;
496 }
497
498 if (!Clip)
499 {
500 Clip = pcoPriv = EngCreateClip();
501 if (!Clip)
502 {
503 return FALSE;
504 }
505 IntEngUpdateClipRegion((XCLIPOBJ*)Clip, 0, 0, RectBounds);
506 }
507
508 x1 += Translate.x;
509 x2 += Translate.x;
510 y1 += Translate.y;
511 y2 += Translate.y;
512
513 x = x1;
514 y = y1;
515 deltax = x2 - x1;
516 deltay = y2 - y1;
517
518 if (0 == deltax && 0 == deltay)
519 {
520 return TRUE;
521 }
522
523 if (deltax < 0)
524 {
525 xchange = -1;
526 deltax = - deltax;
527 hx = x2 + 1;
528 }
529 else
530 {
531 xchange = 1;
532 hx = x1;
533 }
534
535 if (deltay < 0)
536 {
537 ychange = -1;
538 deltay = - deltay;
539 vy = y2 + 1;
540 }
541 else
542 {
543 ychange = 1;
544 vy = y1;
545 }
546
547 if ((y1 == y2) && (cStyles == 0))
548 {
550 do
551 {
552 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
553 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top + Translate.y <= y1; i++)
554 {
555 if (y1 < RectEnum.arcl[i].bottom + Translate.y &&
556 RectEnum.arcl[i].left + Translate.x <= hx + deltax &&
557 hx < RectEnum.arcl[i].right + Translate.x &&
558 max(hx, RectEnum.arcl[i].left + Translate.x) <
559 min(hx + deltax, RectEnum.arcl[i].right + Translate.x))
560 {
562 OutputObj,
563 max(hx, RectEnum.arcl[i].left + Translate.x),
564 min(hx + deltax, RectEnum.arcl[i].right + Translate.x),
565 y1, Pixel);
566 }
567 }
568 }
569 while (EnumMore);
570 }
571 else if ((x1 == x2) && (cStyles == 0))
572 {
574 do
575 {
576 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
577 for (i = 0; i < RectEnum.c; i++)
578 {
579 if (RectEnum.arcl[i].left + Translate.x <= x1 &&
580 x1 < RectEnum.arcl[i].right + Translate.x &&
581 RectEnum.arcl[i].top + Translate.y <= vy + deltay &&
582 vy < RectEnum.arcl[i].bottom + Translate.y)
583 {
585 OutputObj, x1,
586 max(vy, RectEnum.arcl[i].top + Translate.y),
587 min(vy + deltay, RectEnum.arcl[i].bottom + Translate.y),
588 Pixel);
589 }
590 }
591 }
592 while (EnumMore);
593 }
594 else
595 {
596 if (0 < xchange)
597 {
598 if (0 < ychange)
599 {
600 NWtoSE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
601 }
602 else
603 {
604 SWtoNE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
605 }
606 }
607 else
608 {
609 if (0 < ychange)
610 {
611 NEtoSW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
612 }
613 else
614 {
615 SEtoNW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
616 }
617 }
618 }
619
620 if (pcoPriv)
621 {
622 EngDeleteClip(pcoPriv);
623 }
624
625 return IntEngLeave(&EnterLeave);
626}
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL APIENTRY IntEngEnter(PINTENG_ENTER_LEAVE EnterLeave, SURFOBJ *psoDest, RECTL *DestRect, BOOL ReadOnly, POINTL *Translate, SURFOBJ **ppsoOutput)
Definition: engmisc.c:15
BOOL APIENTRY IntEngLeave(PINTENG_ENTER_LEAVE EnterLeave)
Definition: engmisc.c:162
unsigned int BOOL
Definition: ntddk_ex.h:94
void FASTCALL SWtoNE(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:181
void FASTCALL NEtoSW(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:269
void FASTCALL SEtoNW(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:357
void FASTCALL NWtoSE(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:92
struct _EBRUSHOBJ * PEBRUSHOBJ
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
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 min(a, b)
Definition: monoChain.cc:55
long LONG
Definition: pedump.c:60
PFN_DIB_HLine DIB_HLine
Definition: dib.h:47
PFN_DIB_VLine DIB_VLine
Definition: dib.h:48
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
PBRUSH pbrush
Definition: brush.h:88
LONG y
Definition: windef.h:124
LONG x
Definition: windef.h:123
ULONG c
Definition: vgaddi.h:78
RECTL arcl[ENUM_RECT_LIMIT]
Definition: vgaddi.h:79
ULONG iBitmapFormat
Definition: winddi.h:1215
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG
Definition: typedefs.h:59
DIB_FUNCTIONS DibFunctionsForBitmapFormat[]
Definition: dib.c:20
VOID FASTCALL IntEngUpdateClipRegion(XCLIPOBJ *Clip, ULONG count, const RECTL *pRect, const RECTL *rcBounds)
Definition: clip.c:173
ENGAPI CLIPOBJ *APIENTRY EngCreateClip(VOID)
Definition: clip.c:222
ENGAPI VOID APIENTRY EngDeleteClip(_In_ _Post_ptr_invalid_ CLIPOBJ *pco)
Definition: clip.c:241
#define CT_RECTANGLES
Definition: winddi.h:1317
ENGAPI BOOL APIENTRY CLIPOBJ_bEnum(_In_ CLIPOBJ *pco, _In_ ULONG cj, _Out_bytecap_(cj) ULONG *pul)
Definition: clip.c:319
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3708
ENGAPI ULONG APIENTRY CLIPOBJ_cEnumStart(_Inout_ CLIPOBJ *pco, _In_ BOOL bAll, _In_ ULONG iType, _In_ ULONG iDirection, _In_ ULONG cLimit)
Definition: clip.c:255
#define CD_RIGHTDOWN
Definition: winddi.h:1320
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
_In_opt_ SURFOBJ _In_opt_ SURFOBJ _In_ CLIPOBJ _In_opt_ XLATEOBJ _In_ RECTL _In_opt_ POINTL _In_opt_ POINTL _In_opt_ BRUSHOBJ * pbo
Definition: winddi.h:3440
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710

Referenced by IntEngLineTo().

◆ HandleStyles()

LONG HandleStyles ( BRUSHOBJ pbo,
POINTL Translate,
LONG  x,
LONG  y,
LONG  deltax,
LONG  deltay,
LONG  dx,
LONG  dy,
PULONG  piStyle 
)

Definition at line 32 of file lineto.c.

42{
44 PULONG pulStyles = pebo->pbrush->pStyle;
45 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
46 LONG diStyle, offStyle, lStyleMax;
47
48 if (cStyles > 0)
49 {
50 if (deltax > deltay)
51 {
52 offStyle = (- Translate->x) % pebo->pbrush->ulStyleSize;
53 diStyle = dx;
54 lStyleMax = x;
55 }
56 else
57 {
58 offStyle = (- Translate->y) % pebo->pbrush->ulStyleSize;
59 diStyle = dy;
60 lStyleMax = y;
61 }
62
63 /* Now loop until we have found the style index */
64 for (iStyle = 0; offStyle >= pulStyles[iStyle]; iStyle++)
65 {
66 offStyle -= pulStyles[iStyle];
67 }
68
69 if (diStyle > 0)
70 {
71 lStyleMax += pulStyles[iStyle] - offStyle;
72 }
73 else
74 {
75 lStyleMax -= offStyle + 1;
76 }
77 }
78 else
79 {
80 iStyle = 0;
81 lStyleMax = MAXLONG;
82 }
83
84 *piStyle = iStyle;
85 return lStyleMax;
86}
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
uint32_t * PULONG
Definition: typedefs.h:59
#define MAXLONG
Definition: umtypes.h:116

Referenced by NEtoSW(), NWtoSE(), SEtoNW(), and SWtoNE().

◆ IntEngLineTo()

BOOL APIENTRY IntEngLineTo ( SURFOBJ psoDest,
CLIPOBJ ClipObj,
BRUSHOBJ pbo,
LONG  x1,
LONG  y1,
LONG  x2,
LONG  y2,
RECTL RectBounds,
MIX  Mix 
)

Definition at line 629 of file lineto.c.

638{
639 BOOLEAN ret;
640 SURFACE *psurfDest;
641 PEBRUSHOBJ GdiBrush;
642 RECTL b;
643
644 ASSERT(psoDest);
645 psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
646 ASSERT(psurfDest);
647
648 GdiBrush = CONTAINING_RECORD(
649 pbo,
650 EBRUSHOBJ,
651 BrushObject);
652 ASSERT(GdiBrush);
653 ASSERT(GdiBrush->pbrush);
654
655 if (GdiBrush->pbrush->flAttrs & BR_IS_NULL)
656 return TRUE;
657
658 /* No success yet */
659 ret = FALSE;
660
661 /* Clip lines totally outside the clip region. This is not done as an
662 * optimization (there are very few lines drawn outside the region) but
663 * as a workaround for what seems to be a problem in the CL54XX driver */
664 if (NULL == ClipObj || DC_TRIVIAL == ClipObj->iDComplexity)
665 {
666 b.left = 0;
667 b.right = psoDest->sizlBitmap.cx;
668 b.top = 0;
669 b.bottom = psoDest->sizlBitmap.cy;
670 }
671 else
672 {
673 b = ClipObj->rclBounds;
674 }
675 if ((x1 < b.left && x2 < b.left) || (b.right <= x1 && b.right <= x2) ||
676 (y1 < b.top && y2 < b.top) || (b.bottom <= y1 && b.bottom <= y2))
677 {
678 return TRUE;
679 }
680
681 b.left = min(x1, x2);
682 b.right = max(x1, x2);
683 b.top = min(y1, y2);
684 b.bottom = max(y1, y2);
685 if (b.left == b.right) b.right++;
686 if (b.top == b.bottom) b.bottom++;
687
688 if (psurfDest->flags & HOOK_LINETO)
689 {
690 /* Call the driver's DrvLineTo */
691 ret = GDIDEVFUNCS(psoDest).LineTo(
692 psoDest, ClipObj, pbo, x1, y1, x2, y2, &b, Mix);
693 }
694
695#if 0
696 if (! ret && (psurfDest->flags & HOOK_STROKEPATH))
697 {
698 /* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */
699 }
700#endif
701
702 if (! ret)
703 {
704 ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
705 }
706
707 return ret;
708}
unsigned char BOOLEAN
return ret
Definition: mutex.c:146
BOOL APIENTRY EngLineTo(_Inout_ SURFOBJ *DestObj, _In_ CLIPOBJ *Clip, _In_ BRUSHOBJ *pbo, _In_ LONG x1, _In_ LONG y1, _In_ LONG x2, _In_ LONG y2, _In_opt_ RECTL *RectBounds, _In_ MIX mix)
Definition: lineto.c:448
#define BR_IS_NULL
Definition: brush.h:105
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
#define ASSERT(a)
Definition: mode.c:44
BYTE iDComplexity
Definition: winddi.h:278
RECTL rclBounds
Definition: winddi.h:277
LONG cx
Definition: kdterminal.h:27
LONG cy
Definition: kdterminal.h:28
FLONG flags
Definition: surface.h:10
SIZEL sizlBitmap
Definition: winddi.h:1209
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
#define GDIDEVFUNCS(SurfObj)
Definition: surface.h:106
#define DC_TRIVIAL
Definition: winddi.h:259
#define HOOK_LINETO
Definition: winddi.h:1428
#define HOOK_STROKEPATH
Definition: winddi.h:1425

Referenced by IntEngPolyline().

◆ IntEngPolyline()

BOOL APIENTRY IntEngPolyline ( SURFOBJ psoDest,
CLIPOBJ Clip,
BRUSHOBJ pbo,
CONST LPPOINT  pt,
LONG  dCount,
MIX  Mix 
)

Definition at line 711 of file lineto.c.

717{
718 LONG i;
719 RECTL rect;
720 BOOL ret = FALSE;
721
722 // Draw the Polyline with a call to IntEngLineTo for each segment.
723 for (i = 1; i < dCount; i++)
724 {
725 rect.left = min(pt[i-1].x, pt[i].x);
726 rect.top = min(pt[i-1].y, pt[i].y);
727 rect.right = max(pt[i-1].x, pt[i].x);
728 rect.bottom = max(pt[i-1].y, pt[i].y);
729 ret = IntEngLineTo(psoDest,
730 Clip,
731 pbo,
732 pt[i-1].x,
733 pt[i-1].y,
734 pt[i].x,
735 pt[i].y,
736 &rect,
737 Mix);
738 if (!ret)
739 {
740 break;
741 }
742 }
743
744 return ret;
745}
#define pt(x, y)
Definition: drawing.c:79
BOOL APIENTRY IntEngLineTo(SURFOBJ *psoDest, CLIPOBJ *ClipObj, BRUSHOBJ *pbo, LONG x1, LONG y1, LONG x2, LONG y2, RECTL *RectBounds, MIX Mix)
Definition: lineto.c:629
& rect
Definition: startmenu.cpp:1413

Referenced by IntGdiPolyline().

◆ NEtoSW()

void FASTCALL NEtoSW ( SURFOBJ OutputObj,
CLIPOBJ Clip,
BRUSHOBJ pbo,
LONG  x,
LONG  y,
LONG  deltax,
LONG  deltay,
POINTL Translate 
)

Definition at line 269 of file lineto.c.

272{
273 int i;
274 int error;
275 BOOLEAN EnumMore;
276 RECTL* ClipRect;
277 RECT_ENUM RectEnum;
278 ULONG Pixel = pbo->iSolidColor;
279 LONG delta;
280 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
281 PULONG pulStyles = pebo->pbrush->pStyle;
282 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
283 LONG lStyleMax;
284
285 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, -1, 1, &iStyle);
286
288 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
289 TranslateRects(&RectEnum, Translate);
290 ClipRect = RectEnum.arcl;
291 delta = max(deltax, deltay);
292 i = 0;
293 error = delta >> 1;
294 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
295 {
296 while ((ClipRect < RectEnum.arcl + RectEnum.c
297 && (ClipRect->bottom <= y
298 || (ClipRect->top <= y && x < ClipRect->left)))
299 || EnumMore)
300 {
301 if (RectEnum.arcl + RectEnum.c <= ClipRect)
302 {
303 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
304 TranslateRects(&RectEnum, Translate);
305 ClipRect = RectEnum.arcl;
306 }
307 else
308 {
309 ClipRect++;
310 }
311 }
312 if (ClipRect < RectEnum.arcl + RectEnum.c)
313 {
314 if ((x < ClipRect->right && ClipRect->top <= y) && ((iStyle & 1) == 0))
315 {
317 OutputObj, x, y, Pixel);
318 }
319 if (deltax < deltay)
320 {
321 y++;
322 if (y == lStyleMax)
323 {
324 ASSERT(cStyles);
325 iStyle = (iStyle + 1) % cStyles;
326 lStyleMax = y + pulStyles[iStyle];
327 }
328 error = error + deltax;
329 if (deltay <= error)
330 {
331 x--;
332 error = error - deltay;
333 }
334 }
335 else
336 {
337 x--;
338 if (x == lStyleMax)
339 {
340 ASSERT(cStyles);
341 iStyle = (iStyle - 1) % cStyles;
342 lStyleMax = x - pulStyles[iStyle];
343 }
344 error = error + deltay;
345 if (deltax <= error)
346 {
347 y++;
348 error = error - deltax;
349 }
350 }
351 i++;
352 }
353 }
354}
LONG HandleStyles(BRUSHOBJ *pbo, POINTL *Translate, LONG x, LONG y, LONG deltax, LONG deltay, LONG dx, LONG dy, PULONG piStyle)
Definition: lineto.c:32
static void FASTCALL TranslateRects(RECT_ENUM *RectEnum, POINTL *Translate)
Definition: lineto.c:15
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define error(str)
Definition: mkdosfs.c:1605
PFN_DIB_PutPixel DIB_PutPixel
Definition: dib.h:45
#define CD_LEFTDOWN
Definition: winddi.h:1321

Referenced by EngLineTo().

◆ NWtoSE()

void FASTCALL NWtoSE ( SURFOBJ OutputObj,
CLIPOBJ Clip,
BRUSHOBJ pbo,
LONG  x,
LONG  y,
LONG  deltax,
LONG  deltay,
POINTL Translate 
)

Definition at line 92 of file lineto.c.

95{
96 int i;
97 int error;
98 BOOLEAN EnumMore;
99 RECTL* ClipRect;
100 RECT_ENUM RectEnum;
101 ULONG Pixel = pbo->iSolidColor;
102 LONG delta;
103 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
104 PULONG pulStyles = pebo->pbrush->pStyle;
105 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
106 LONG lStyleMax;
107
108 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, 1, 1, &iStyle);
109
111 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
112 TranslateRects(&RectEnum, Translate);
113 ClipRect = RectEnum.arcl;
114 delta = max(deltax, deltay);
115 i = 0;
116 error = delta >> 1;
117 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
118 {
119 while ((ClipRect < RectEnum.arcl + RectEnum.c /* there's still a current clip rect */
120 && (ClipRect->bottom <= y /* but it's above us */
121 || (ClipRect->top <= y && ClipRect->right <= x))) /* or to the left of us */
122 || EnumMore) /* no current clip rect, but rects left */
123 {
124 /* Skip to the next clip rect */
125 if (RectEnum.arcl + RectEnum.c <= ClipRect)
126 {
127 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
128 TranslateRects(&RectEnum, Translate);
129 ClipRect = RectEnum.arcl;
130 }
131 else
132 {
133 ClipRect++;
134 }
135 }
136 if (ClipRect < RectEnum.arcl + RectEnum.c) /* If there's no current clip rect we're done */
137 {
138 if ((ClipRect->left <= x && ClipRect->top <= y) && ((iStyle & 1) == 0))
139 {
141 OutputObj, x, y, Pixel);
142 }
143 if (deltax < deltay)
144 {
145 y++;
146 if (y == lStyleMax)
147 {
148 ASSERT(cStyles);
149 iStyle = (iStyle + 1) % cStyles;
150 lStyleMax = y + pulStyles[iStyle];
151 }
152 error = error + deltax;
153 if (deltay <= error)
154 {
155 x++;
156 error = error - deltay;
157 }
158 }
159 else
160 {
161 x++;
162 if (x == lStyleMax)
163 {
164 ASSERT(cStyles);
165 iStyle = (iStyle + 1) % cStyles;
166 lStyleMax = x + pulStyles[iStyle];
167 }
168 error = error + deltay;
169 if (deltax <= error)
170 {
171 y++;
172 error = error - deltax;
173 }
174 }
175 i++;
176 }
177 }
178}

Referenced by EngLineTo().

◆ SEtoNW()

void FASTCALL SEtoNW ( SURFOBJ OutputObj,
CLIPOBJ Clip,
BRUSHOBJ pbo,
LONG  x,
LONG  y,
LONG  deltax,
LONG  deltay,
POINTL Translate 
)

Definition at line 357 of file lineto.c.

360{
361 int i;
362 int error;
363 BOOLEAN EnumMore;
364 RECTL* ClipRect;
365 RECT_ENUM RectEnum;
366 ULONG Pixel = pbo->iSolidColor;
367 LONG delta;
368 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
369 PULONG pulStyles = pebo->pbrush->pStyle;
370 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
371 LONG lStyleMax;
372
373 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, -1, -1, &iStyle);
374
376 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
377 TranslateRects(&RectEnum, Translate);
378 ClipRect = RectEnum.arcl;
379 delta = max(deltax, deltay);
380 i = 0;
381 error = delta >> 1;
382 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
383 {
384 while ((ClipRect < RectEnum.arcl + RectEnum.c
385 && (y < ClipRect->top
386 || (y < ClipRect->bottom && x < ClipRect->left)))
387 || EnumMore)
388 {
389 if (RectEnum.arcl + RectEnum.c <= ClipRect)
390 {
391 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
392 TranslateRects(&RectEnum, Translate);
393 ClipRect = RectEnum.arcl;
394 }
395 else
396 {
397 ClipRect++;
398 }
399 }
400 if (ClipRect < RectEnum.arcl + RectEnum.c)
401 {
402 if ((x < ClipRect->right && y < ClipRect->bottom) && ((iStyle & 1) == 0))
403 {
405 OutputObj, x, y, Pixel);
406 }
407 if (deltax < deltay)
408 {
409 y--;
410 if (y == lStyleMax)
411 {
412 ASSERT(cStyles);
413 iStyle = (iStyle - 1) % cStyles;
414 lStyleMax = y - pulStyles[iStyle];
415 }
416 error = error + deltax;
417 if (deltay <= error)
418 {
419 x--;
420 error = error - deltay;
421 }
422 }
423 else
424 {
425 x--;
426 if (x == lStyleMax)
427 {
428 ASSERT(cStyles);
429 iStyle = (iStyle - 1) % cStyles;
430 lStyleMax = x - pulStyles[iStyle];
431 }
432 error = error + deltay;
433 if (deltax <= error)
434 {
435 y--;
436 error = error - deltax;
437 }
438 }
439 i++;
440 }
441 }
442}
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLint GLint bottom
Definition: glext.h:7726
#define CD_LEFTUP
Definition: winddi.h:1325

Referenced by EngLineTo().

◆ SWtoNE()

void FASTCALL SWtoNE ( SURFOBJ OutputObj,
CLIPOBJ Clip,
BRUSHOBJ pbo,
LONG  x,
LONG  y,
LONG  deltax,
LONG  deltay,
POINTL Translate 
)

Definition at line 181 of file lineto.c.

184{
185 int i;
186 int error;
187 BOOLEAN EnumMore;
188 RECTL* ClipRect;
189 RECT_ENUM RectEnum;
190 ULONG Pixel = pbo->iSolidColor;
191 LONG delta;
192 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
193 PULONG pulStyles = pebo->pbrush->pStyle;
194 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
195 LONG lStyleMax;
196
197 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, 1, -1, &iStyle);
198
200 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
201 TranslateRects(&RectEnum, Translate);
202 ClipRect = RectEnum.arcl;
203 delta = max(deltax, deltay);
204 i = 0;
205 error = delta >> 1;
206 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
207 {
208 while ((ClipRect < RectEnum.arcl + RectEnum.c
209 && (y < ClipRect->top
210 || (y < ClipRect->bottom && ClipRect->right <= x)))
211 || EnumMore)
212 {
213 if (RectEnum.arcl + RectEnum.c <= ClipRect)
214 {
215 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
216 TranslateRects(&RectEnum, Translate);
217 ClipRect = RectEnum.arcl;
218 }
219 else
220 {
221 ClipRect++;
222 }
223 }
224 if (ClipRect < RectEnum.arcl + RectEnum.c)
225 {
226 if ((ClipRect->left <= x && y < ClipRect->bottom) && ((iStyle & 1) == 0))
227 {
229 OutputObj, x, y, Pixel);
230 }
231 if (deltax < deltay)
232 {
233 y--;
234 if (y == lStyleMax)
235 {
236 ASSERT(cStyles);
237 iStyle = (iStyle - 1) % cStyles;
238 lStyleMax = y - pulStyles[iStyle];
239 }
240 error = error + deltax;
241 if (deltay <= error)
242 {
243 x++;
244 error = error - deltay;
245 }
246 }
247 else
248 {
249 x++;
250 if (x == lStyleMax)
251 {
252 ASSERT(cStyles);
253 iStyle = (iStyle + 1) % cStyles;
254 lStyleMax = x + pulStyles[iStyle];
255 }
256 error = error + deltay;
257 if (deltax <= error)
258 {
259 y--;
260 error = error - deltax;
261 }
262 }
263 i++;
264 }
265 }
266}
#define CD_RIGHTUP
Definition: winddi.h:1323

Referenced by EngLineTo().

◆ TranslateRects()

static void FASTCALL TranslateRects ( RECT_ENUM RectEnum,
POINTL Translate 
)
static

Definition at line 15 of file lineto.c.

16{
17 RECTL* CurrentRect;
18
19 if (0 != Translate->x || 0 != Translate->y)
20 {
21 for (CurrentRect = RectEnum->arcl; CurrentRect < RectEnum->arcl + RectEnum->c; CurrentRect++)
22 {
23 CurrentRect->left += Translate->x;
24 CurrentRect->right += Translate->x;
25 CurrentRect->top += Translate->y;
26 CurrentRect->bottom += Translate->y;
27 }
28 }
29}

Referenced by NEtoSW(), NWtoSE(), SEtoNW(), and SWtoNE().