ReactOS 0.4.15-dev-8135-g1bc6c90
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 440 of file lineto.c.

450{
451 LONG x, y, deltax, deltay, xchange, ychange, hx, vy;
452 ULONG i;
453 ULONG Pixel = pbo->iSolidColor;
454 SURFOBJ *OutputObj;
455 RECTL DestRect;
456 POINTL Translate;
457 INTENG_ENTER_LEAVE EnterLeave;
458 RECT_ENUM RectEnum;
459 BOOL EnumMore;
460 CLIPOBJ *pcoPriv = NULL;
461 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
462 ULONG cStyles = pebo->pbrush->dwStyleCount;
463
464 if (x1 < x2)
465 {
466 DestRect.left = x1;
467 DestRect.right = x2;
468 }
469 else
470 {
471 DestRect.left = x2;
472 DestRect.right = x1 + 1;
473 }
474 if (y1 < y2)
475 {
476 DestRect.top = y1;
477 DestRect.bottom = y2;
478 }
479 else
480 {
481 DestRect.top = y2;
482 DestRect.bottom = y1 + 1;
483 }
484
485 if (! IntEngEnter(&EnterLeave, DestObj, &DestRect, FALSE, &Translate, &OutputObj))
486 {
487 return FALSE;
488 }
489
490 if (!Clip)
491 {
492 Clip = pcoPriv = EngCreateClip();
493 if (!Clip)
494 {
495 return FALSE;
496 }
497 IntEngUpdateClipRegion((XCLIPOBJ*)Clip, 0, 0, RectBounds);
498 }
499
500 x1 += Translate.x;
501 x2 += Translate.x;
502 y1 += Translate.y;
503 y2 += Translate.y;
504
505 x = x1;
506 y = y1;
507 deltax = x2 - x1;
508 deltay = y2 - y1;
509
510 if (0 == deltax && 0 == deltay)
511 {
512 return TRUE;
513 }
514
515 if (deltax < 0)
516 {
517 xchange = -1;
518 deltax = - deltax;
519 hx = x2 + 1;
520 }
521 else
522 {
523 xchange = 1;
524 hx = x1;
525 }
526
527 if (deltay < 0)
528 {
529 ychange = -1;
530 deltay = - deltay;
531 vy = y2 + 1;
532 }
533 else
534 {
535 ychange = 1;
536 vy = y1;
537 }
538
539 if ((y1 == y2) && (cStyles == 0))
540 {
542 do
543 {
544 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
545 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top + Translate.y <= y1; i++)
546 {
547 if (y1 < RectEnum.arcl[i].bottom + Translate.y &&
548 RectEnum.arcl[i].left + Translate.x <= hx + deltax &&
549 hx < RectEnum.arcl[i].right + Translate.x &&
550 max(hx, RectEnum.arcl[i].left + Translate.x) <
551 min(hx + deltax, RectEnum.arcl[i].right + Translate.x))
552 {
554 OutputObj,
555 max(hx, RectEnum.arcl[i].left + Translate.x),
556 min(hx + deltax, RectEnum.arcl[i].right + Translate.x),
557 y1, Pixel);
558 }
559 }
560 }
561 while (EnumMore);
562 }
563 else if ((x1 == x2) && (cStyles == 0))
564 {
566 do
567 {
568 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
569 for (i = 0; i < RectEnum.c; i++)
570 {
571 if (RectEnum.arcl[i].left + Translate.x <= x1 &&
572 x1 < RectEnum.arcl[i].right + Translate.x &&
573 RectEnum.arcl[i].top + Translate.y <= vy + deltay &&
574 vy < RectEnum.arcl[i].bottom + Translate.y)
575 {
577 OutputObj, x1,
578 max(vy, RectEnum.arcl[i].top + Translate.y),
579 min(vy + deltay, RectEnum.arcl[i].bottom + Translate.y),
580 Pixel);
581 }
582 }
583 }
584 while (EnumMore);
585 }
586 else
587 {
588 if (0 < xchange)
589 {
590 if (0 < ychange)
591 {
592 NWtoSE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
593 }
594 else
595 {
596 SWtoNE(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
597 }
598 }
599 else
600 {
601 if (0 < ychange)
602 {
603 NEtoSW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
604 }
605 else
606 {
607 SEtoNW(OutputObj, Clip, pbo, x, y, deltax, deltay, &Translate);
608 }
609 }
610 }
611
612 if (pcoPriv)
613 {
614 EngDeleteClip(pcoPriv);
615 }
616
617 return IntEngLeave(&EnterLeave);
618}
#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:179
void FASTCALL NEtoSW(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:265
void FASTCALL SEtoNW(SURFOBJ *OutputObj, CLIPOBJ *Clip, BRUSHOBJ *pbo, LONG x, LONG y, LONG deltax, LONG deltay, POINTL *Translate)
Definition: lineto.c:351
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:330
LONG x
Definition: windef.h:329
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
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3710
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3709
#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
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3711
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_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

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 = MAX_COORD;
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 MAX_COORD
Definition: region.c:12

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 621 of file lineto.c.

630{
631 BOOLEAN ret;
632 SURFACE *psurfDest;
633 PEBRUSHOBJ GdiBrush;
634 RECTL b;
635
636 ASSERT(psoDest);
637 psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
638 ASSERT(psurfDest);
639
640 GdiBrush = CONTAINING_RECORD(
641 pbo,
642 EBRUSHOBJ,
643 BrushObject);
644 ASSERT(GdiBrush);
645 ASSERT(GdiBrush->pbrush);
646
647 if (GdiBrush->pbrush->flAttrs & BR_IS_NULL)
648 return TRUE;
649
650 /* No success yet */
651 ret = FALSE;
652
653 /* Clip lines totally outside the clip region. This is not done as an
654 * optimization (there are very few lines drawn outside the region) but
655 * as a workaround for what seems to be a problem in the CL54XX driver */
656 if (NULL == ClipObj || DC_TRIVIAL == ClipObj->iDComplexity)
657 {
658 b.left = 0;
659 b.right = psoDest->sizlBitmap.cx;
660 b.top = 0;
661 b.bottom = psoDest->sizlBitmap.cy;
662 }
663 else
664 {
665 b = ClipObj->rclBounds;
666 }
667 if ((x1 < b.left && x2 < b.left) || (b.right <= x1 && b.right <= x2) ||
668 (y1 < b.top && y2 < b.top) || (b.bottom <= y1 && b.bottom <= y2))
669 {
670 return TRUE;
671 }
672
673 b.left = min(x1, x2);
674 b.right = max(x1, x2);
675 b.top = min(y1, y2);
676 b.bottom = max(y1, y2);
677 if (b.left == b.right) b.right++;
678 if (b.top == b.bottom) b.bottom++;
679
680 if (psurfDest->flags & HOOK_LINETO)
681 {
682 /* Call the driver's DrvLineTo */
683 ret = GDIDEVFUNCS(psoDest).LineTo(
684 psoDest, ClipObj, pbo, x1, y1, x2, y2, &b, Mix);
685 }
686
687#if 0
688 if (! ret && (psurfDest->flags & HOOK_STROKEPATH))
689 {
690 /* FIXME: Emulate LineTo using drivers DrvStrokePath and set ret on success */
691 }
692#endif
693
694 if (! ret)
695 {
696 ret = EngLineTo(psoDest, ClipObj, pbo, x1, y1, x2, y2, RectBounds, Mix);
697 }
698
699 return ret;
700}
unsigned char BOOLEAN
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:440
#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
int ret
#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 703 of file lineto.c.

709{
710 LONG i;
711 RECTL rect;
712 BOOL ret = FALSE;
713
714 // Draw the Polyline with a call to IntEngLineTo for each segment.
715 for (i = 1; i < dCount; i++)
716 {
717 rect.left = min(pt[i-1].x, pt[i].x);
718 rect.top = min(pt[i-1].y, pt[i].y);
719 rect.right = max(pt[i-1].x, pt[i].x);
720 rect.bottom = max(pt[i-1].y, pt[i].y);
721 ret = IntEngLineTo(psoDest,
722 Clip,
723 pbo,
724 pt[i-1].x,
725 pt[i-1].y,
726 pt[i].x,
727 pt[i].y,
728 &rect,
729 Mix);
730 if (!ret)
731 {
732 break;
733 }
734 }
735
736 return ret;
737}
#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:621
& 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 265 of file lineto.c.

268{
269 int i;
270 int error;
271 BOOLEAN EnumMore;
272 RECTL* ClipRect;
273 RECT_ENUM RectEnum;
274 ULONG Pixel = pbo->iSolidColor;
275 LONG delta;
276 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
277 PULONG pulStyles = pebo->pbrush->pStyle;
278 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
279 LONG lStyleMax;
280
281 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, -1, 1, &iStyle);
282
284 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
285 TranslateRects(&RectEnum, Translate);
286 ClipRect = RectEnum.arcl;
287 delta = max(deltax, deltay);
288 i = 0;
289 error = delta >> 1;
290 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
291 {
292 while ((ClipRect < RectEnum.arcl + RectEnum.c
293 && (ClipRect->bottom <= y
294 || (ClipRect->top <= y && x < ClipRect->left)))
295 || EnumMore)
296 {
297 if (RectEnum.arcl + RectEnum.c <= ClipRect)
298 {
299 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
300 TranslateRects(&RectEnum, Translate);
301 ClipRect = RectEnum.arcl;
302 }
303 else
304 {
305 ClipRect++;
306 }
307 }
308 if (ClipRect < RectEnum.arcl + RectEnum.c)
309 {
310 if ((x < ClipRect->right && ClipRect->top <= y) && ((iStyle & 1) == 0))
311 {
313 OutputObj, x, y, Pixel);
314 }
315 if (deltax < deltay)
316 {
317 y++;
318 if (y == lStyleMax)
319 {
320 iStyle = (iStyle + 1) % cStyles;
321 lStyleMax = y + pulStyles[iStyle];
322 }
323 error = error + deltax;
324 if (deltay <= error)
325 {
326 x--;
327 error = error - deltay;
328 }
329 }
330 else
331 {
332 x--;
333 if (x == lStyleMax)
334 {
335 iStyle = (iStyle - 1) % cStyles;
336 lStyleMax = x - pulStyles[iStyle];
337 }
338 error = error + deltay;
339 if (deltax <= error)
340 {
341 y++;
342 error = error - deltax;
343 }
344 }
345 i++;
346 }
347 }
348}
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 iStyle = (iStyle + 1) % cStyles;
149 lStyleMax = y + pulStyles[iStyle];
150 }
151 error = error + deltax;
152 if (deltay <= error)
153 {
154 x++;
155 error = error - deltay;
156 }
157 }
158 else
159 {
160 x++;
161 if (x == lStyleMax)
162 {
163 iStyle = (iStyle + 1) % cStyles;
164 lStyleMax = x + pulStyles[iStyle];
165 }
166 error = error + deltay;
167 if (deltax <= error)
168 {
169 y++;
170 error = error - deltax;
171 }
172 }
173 i++;
174 }
175 }
176}

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 351 of file lineto.c.

354{
355 int i;
356 int error;
357 BOOLEAN EnumMore;
358 RECTL* ClipRect;
359 RECT_ENUM RectEnum;
360 ULONG Pixel = pbo->iSolidColor;
361 LONG delta;
362 PEBRUSHOBJ pebo = (PEBRUSHOBJ)pbo;
363 PULONG pulStyles = pebo->pbrush->pStyle;
364 ULONG iStyle, cStyles = pebo->pbrush->dwStyleCount;
365 LONG lStyleMax;
366
367 lStyleMax = HandleStyles(pbo, Translate, x, y, deltax, deltay, -1, -1, &iStyle);
368
370 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
371 TranslateRects(&RectEnum, Translate);
372 ClipRect = RectEnum.arcl;
373 delta = max(deltax, deltay);
374 i = 0;
375 error = delta >> 1;
376 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
377 {
378 while ((ClipRect < RectEnum.arcl + RectEnum.c
379 && (y < ClipRect->top
380 || (y < ClipRect->bottom && x < ClipRect->left)))
381 || EnumMore)
382 {
383 if (RectEnum.arcl + RectEnum.c <= ClipRect)
384 {
385 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
386 TranslateRects(&RectEnum, Translate);
387 ClipRect = RectEnum.arcl;
388 }
389 else
390 {
391 ClipRect++;
392 }
393 }
394 if (ClipRect < RectEnum.arcl + RectEnum.c)
395 {
396 if ((x < ClipRect->right && y < ClipRect->bottom) && ((iStyle & 1) == 0))
397 {
399 OutputObj, x, y, Pixel);
400 }
401 if (deltax < deltay)
402 {
403 y--;
404 if (y == lStyleMax)
405 {
406 iStyle = (iStyle - 1) % cStyles;
407 lStyleMax = y - pulStyles[iStyle];
408 }
409 error = error + deltax;
410 if (deltay <= error)
411 {
412 x--;
413 error = error - deltay;
414 }
415 }
416 else
417 {
418 x--;
419 if (x == lStyleMax)
420 {
421 iStyle = (iStyle - 1) % cStyles;
422 lStyleMax = x - pulStyles[iStyle];
423 }
424 error = error + deltay;
425 if (deltax <= error)
426 {
427 y--;
428 error = error - deltax;
429 }
430 }
431 i++;
432 }
433 }
434}
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 179 of file lineto.c.

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