afffdfc54a0ce06ce8359692cf6cf7c6abb35617
2 * PROJECT: ReactOS VGA display driver
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: drivers/video/displays/vga/objects/lineto.c
6 * PROGRAMMERS: Copyright (C) 1998-2003 ReactOS Team
12 * Draw a line from top-left to bottom-right
28 ULONG Pixel
= Brush
->iSolidColor
;
31 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_RIGHTDOWN
, 0);
32 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
33 ClipRect
= RectEnum
.arcl
;
34 delta
= max(deltax
, deltay
);
37 while (i
< delta
&& (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
|| EnumMore
))
39 while ((ClipRect
< RectEnum
.arcl
+ RectEnum
.c
/* there's still a current clip rect */
40 && (ClipRect
->bottom
<= y
/* but it's above us */
41 || (ClipRect
->top
<= y
&& ClipRect
->right
<= x
))) /* or to the left of us */
42 || EnumMore
) /* no current clip rect, but rects left */
44 /* Skip to the next clip rect */
45 if (RectEnum
.arcl
+ RectEnum
.c
<= ClipRect
)
47 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
48 ClipRect
= RectEnum
.arcl
;
55 if ( ClipRect
< RectEnum
.arcl
+ RectEnum
.c
) /* If there's no current clip rect we're done */
57 if (ClipRect
->left
<= x
&& ClipRect
->top
<= y
)
58 vgaPutPixel ( x
, y
, Pixel
);
59 if ( deltax
< deltay
)
63 if ( error
>= deltay
)
73 if ( error
>= deltax
)
98 ULONG Pixel
= Brush
->iSolidColor
;
101 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_RIGHTUP
, 0);
102 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
103 ClipRect
= RectEnum
.arcl
;
104 delta
= max(deltax
, deltay
);
107 while (i
< delta
&& (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
|| EnumMore
))
109 while ((ClipRect
< RectEnum
.arcl
+ RectEnum
.c
110 && (y
< ClipRect
->top
111 || (y
< ClipRect
->bottom
&& ClipRect
->right
<= x
)))
114 if (RectEnum
.arcl
+ RectEnum
.c
<= ClipRect
)
116 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
117 ClipRect
= RectEnum
.arcl
;
124 if (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
)
126 if (ClipRect
->left
<= x
&& y
< ClipRect
->bottom
)
127 vgaPutPixel(x
, y
, Pixel
);
131 error
= error
+ deltax
;
135 error
= error
- deltay
;
141 error
= error
+ deltay
;
145 error
= error
- deltax
;
167 ULONG Pixel
= Brush
->iSolidColor
;
170 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_LEFTDOWN
, 0);
171 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
172 ClipRect
= RectEnum
.arcl
;
173 delta
= max(deltax
, deltay
);
176 while (i
< delta
&& (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
|| EnumMore
))
178 while ((ClipRect
< RectEnum
.arcl
+ RectEnum
.c
179 && (ClipRect
->bottom
<= y
180 || (ClipRect
->top
<= y
&& x
< ClipRect
->left
)))
183 if (RectEnum
.arcl
+ RectEnum
.c
<= ClipRect
)
185 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
186 ClipRect
= RectEnum
.arcl
;
193 if (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
)
195 if (x
< ClipRect
->right
&& ClipRect
->top
<= y
)
196 vgaPutPixel(x
, y
, Pixel
);
200 error
= error
+ deltax
;
204 error
= error
- deltay
;
210 error
= error
+ deltay
;
214 error
= error
- deltax
;
236 ULONG Pixel
= Brush
->iSolidColor
;
239 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_LEFTUP
, 0);
240 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
241 ClipRect
= RectEnum
.arcl
;
242 delta
= max(deltax
, deltay
);
245 while (i
< delta
&& (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
|| EnumMore
))
247 while ((ClipRect
< RectEnum
.arcl
+ RectEnum
.c
248 && (y
< ClipRect
->top
249 || (y
< ClipRect
->bottom
&& x
< ClipRect
->left
)))
252 if (RectEnum
.arcl
+ RectEnum
.c
<= ClipRect
)
254 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
255 ClipRect
= RectEnum
.arcl
;
262 if (ClipRect
< RectEnum
.arcl
+ RectEnum
.c
)
264 if (x
< ClipRect
->right
&& y
< ClipRect
->bottom
)
265 vgaPutPixel(x
, y
, Pixel
);
269 error
= error
+ deltax
;
273 error
= error
- deltay
;
279 error
= error
+ deltay
;
283 error
= error
- deltax
;
292 * FIXME: Use Mix to perform ROPs
293 * FIXME: Non-solid Brush
304 IN RECTL
*RectBounds
,
307 LONG x
, y
, deltax
, deltay
, xchange
, ychange
, hx
, vy
;
309 ULONG Pixel
= Brush
->iSolidColor
;
346 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_RIGHTDOWN
, 0);
349 EnumMore
= CLIPOBJ_bEnum(Clip
, sizeof(RectEnum
), (PVOID
) &RectEnum
);
350 for (i
= 0; i
< RectEnum
.c
&& RectEnum
.arcl
[i
].top
<= y1
; i
++)
352 if (y1
< RectEnum
.arcl
[i
].bottom
&&
353 RectEnum
.arcl
[i
].left
<= hx
+ deltax
&&
354 hx
< RectEnum
.arcl
[i
].right
)
356 vgaHLine(max(hx
, RectEnum
.arcl
[i
].left
), y1
,
357 min(hx
+ deltax
, RectEnum
.arcl
[i
].right
)
358 -max(hx
, RectEnum
.arcl
[i
].left
), Pixel
);
365 CLIPOBJ_cEnumStart(Clip
, FALSE
, CT_RECTANGLES
, CD_RIGHTDOWN
, 0);
368 EnumMore
= CLIPOBJ_bEnum(Clip
, (ULONG
) sizeof(RectEnum
), (PVOID
) &RectEnum
);
369 for (i
= 0; i
< RectEnum
.c
; i
++)
371 if (RectEnum
.arcl
[i
].left
<= x1
&&
372 x1
< RectEnum
.arcl
[i
].right
&&
373 RectEnum
.arcl
[i
].top
<= vy
+ deltay
&&
374 vy
< RectEnum
.arcl
[i
].bottom
)
377 max(vy
, RectEnum
.arcl
[i
].top
),
378 min(vy
+ deltay
, RectEnum
.arcl
[i
].bottom
)
379 - max(vy
, RectEnum
.arcl
[i
].top
),
390 vgaNWtoSE(Clip
, Brush
, x
, y
, deltax
, deltay
);
392 vgaSWtoNE(Clip
, Brush
, x
, y
, deltax
, deltay
);
397 vgaNEtoSW(Clip
, Brush
, x
, y
, deltax
, deltay
);
399 vgaSEtoNW(Clip
, Brush
, x
, y
, deltax
, deltay
);