ReactOS 0.4.15-dev-7942-gd23573b
lineto.c File Reference
#include <vgaddi.h>
Include dependency graph for lineto.c:

Go to the source code of this file.

Functions

static void FASTCALL vgaNWtoSE (IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
 
static void FASTCALL vgaSWtoNE (IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
 
static void FASTCALL vgaNEtoSW (IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
 
static void FASTCALL vgaSEtoNW (IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
 
BOOL APIENTRY DrvLineTo (IN SURFOBJ *DestObj, IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x1, IN LONG y1, IN LONG x2, IN LONG y2, IN RECTL *RectBounds, IN MIX mix)
 

Function Documentation

◆ DrvLineTo()

BOOL APIENTRY DrvLineTo ( IN SURFOBJ DestObj,
IN CLIPOBJ Clip,
IN BRUSHOBJ Brush,
IN LONG  x1,
IN LONG  y1,
IN LONG  x2,
IN LONG  y2,
IN RECTL RectBounds,
IN MIX  mix 
)

Definition at line 296 of file lineto.c.

306{
307 LONG x, y, deltax, deltay, xchange, ychange, hx, vy;
308 ULONG i;
309 ULONG Pixel = Brush->iSolidColor;
310 RECT_ENUM RectEnum;
311 BOOL EnumMore;
312
313 x = x1;
314 y = y1;
315 deltax = x2 - x1;
316 deltay = y2 - y1;
317
318 if (deltax < 0)
319 {
320 xchange = -1;
321 deltax = - deltax;
322 hx = x2+1;
323 //x--;
324 }
325 else
326 {
327 xchange = 1;
328 hx = x1;
329 }
330
331 if (deltay < 0)
332 {
333 ychange = -1;
334 deltay = - deltay;
335 vy = y2+1;
336 //y--;
337 }
338 else
339 {
340 ychange = 1;
341 vy = y1;
342 }
343
344 if (y1 == y2)
345 {
347 do
348 {
349 EnumMore = CLIPOBJ_bEnum(Clip, sizeof(RectEnum), (PVOID) &RectEnum);
350 for (i = 0; i < RectEnum.c && RectEnum.arcl[i].top <= y1; i++)
351 {
352 if (y1 < RectEnum.arcl[i].bottom &&
353 RectEnum.arcl[i].left <= hx + deltax &&
354 hx < RectEnum.arcl[i].right)
355 {
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);
359 }
360 }
361 } while (EnumMore);
362 }
363 else if (x1 == x2)
364 {
366 do
367 {
368 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
369 for (i = 0; i < RectEnum.c; i++)
370 {
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)
375 {
376 vgaVLine(x1,
377 max(vy, RectEnum.arcl[i].top),
378 min(vy + deltay, RectEnum.arcl[i].bottom)
379 - max(vy, RectEnum.arcl[i].top),
380 Pixel);
381 }
382 }
383 } while (EnumMore);
384 }
385 else
386 {
387 if (0 < xchange)
388 {
389 if (0 < ychange)
390 vgaNWtoSE(Clip, Brush, x, y, deltax, deltay);
391 else
392 vgaSWtoNE(Clip, Brush, x, y, deltax, deltay);
393 }
394 else
395 {
396 if (0 < ychange)
397 vgaNEtoSW(Clip, Brush, x, y, deltax, deltay);
398 else
399 vgaSEtoNW(Clip, Brush, x, y, deltax, deltay);
400 }
401 }
402
403 return TRUE;
404}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void FASTCALL vgaNWtoSE(IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
Definition: lineto.c:15
static void FASTCALL vgaSEtoNW(IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
Definition: lineto.c:223
static void FASTCALL vgaNEtoSW(IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
Definition: lineto.c:154
static void FASTCALL vgaSWtoNE(IN CLIPOBJ *Clip, IN BRUSHOBJ *Brush, IN LONG x, IN LONG y, IN LONG deltax, IN LONG deltay)
Definition: lineto.c:85
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
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
long bottom
Definition: polytest.cpp:53
long right
Definition: polytest.cpp:53
long top
Definition: polytest.cpp:53
long left
Definition: polytest.cpp:53
ULONG c
Definition: vgaddi.h:78
RECTL arcl[ENUM_RECT_LIMIT]
Definition: vgaddi.h:79
#define max(a, b)
Definition: svc.c:63
uint32_t ULONG
Definition: typedefs.h:59
BOOL vgaVLine(INT x, INT y, INT len, UCHAR c)
Definition: vgavideo.c:308
BOOL vgaHLine(INT x, INT y, INT len, UCHAR c)
Definition: vgavideo.c:231
_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

◆ vgaNEtoSW()

static void FASTCALL vgaNEtoSW ( IN CLIPOBJ Clip,
IN BRUSHOBJ Brush,
IN LONG  x,
IN LONG  y,
IN LONG  deltax,
IN LONG  deltay 
)
static

Definition at line 154 of file lineto.c.

161{
162 int i;
163 int error;
164 BOOLEAN EnumMore;
165 PRECTL ClipRect;
166 RECT_ENUM RectEnum;
167 ULONG Pixel = Brush->iSolidColor;
168 LONG delta;
169
171 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
172 ClipRect = RectEnum.arcl;
173 delta = max(deltax, deltay);
174 i = 0;
175 error = delta / 2;
176 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
177 {
178 while ((ClipRect < RectEnum.arcl + RectEnum.c
179 && (ClipRect->bottom <= y
180 || (ClipRect->top <= y && x < ClipRect->left)))
181 || EnumMore)
182 {
183 if (RectEnum.arcl + RectEnum.c <= ClipRect)
184 {
185 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
186 ClipRect = RectEnum.arcl;
187 }
188 else
189 {
190 ClipRect++;
191 }
192 }
193 if (ClipRect < RectEnum.arcl + RectEnum.c)
194 {
195 if (x < ClipRect->right && ClipRect->top <= y)
196 vgaPutPixel(x, y, Pixel);
197 if (deltax < deltay)
198 {
199 y++;
200 error = error + deltax;
201 if (deltay <= error)
202 {
203 x--;
204 error = error - deltay;
205 }
206 }
207 else
208 {
209 x--;
210 error = error + deltay;
211 if (deltax <= error)
212 {
213 y++;
214 error = error - deltax;
215 }
216 }
217 i++;
218 }
219 }
220}
unsigned char BOOLEAN
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
#define error(str)
Definition: mkdosfs.c:1605
VOID vgaPutPixel(INT x, INT y, UCHAR c)
Definition: vgavideo.c:163
#define CD_LEFTDOWN
Definition: winddi.h:1321

Referenced by DrvLineTo().

◆ vgaNWtoSE()

static void FASTCALL vgaNWtoSE ( IN CLIPOBJ Clip,
IN BRUSHOBJ Brush,
IN LONG  x,
IN LONG  y,
IN LONG  deltax,
IN LONG  deltay 
)
static

Definition at line 15 of file lineto.c.

22{
23 int i;
24 int error;
25 BOOLEAN EnumMore;
26 PRECTL ClipRect;
27 RECT_ENUM RectEnum;
28 ULONG Pixel = Brush->iSolidColor;
29 LONG delta;
30
32 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
33 ClipRect = RectEnum.arcl;
34 delta = max(deltax, deltay);
35 i = 0;
36 error = delta / 2;
37 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
38 {
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 */
43 {
44 /* Skip to the next clip rect */
45 if (RectEnum.arcl + RectEnum.c <= ClipRect)
46 {
47 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
48 ClipRect = RectEnum.arcl;
49 }
50 else
51 {
52 ClipRect++;
53 }
54 }
55 if ( ClipRect < RectEnum.arcl + RectEnum.c ) /* If there's no current clip rect we're done */
56 {
57 if (ClipRect->left <= x && ClipRect->top <= y)
58 vgaPutPixel ( x, y, Pixel );
59 if ( deltax < deltay )
60 {
61 y++;
62 error += deltax;
63 if ( error >= deltay )
64 {
65 x++;
66 error -= deltay;
67 }
68 }
69 else
70 {
71 x++;
72 error += deltay;
73 if ( error >= deltax )
74 {
75 y++;
76 error -= deltax;
77 }
78 }
79 i++;
80 }
81 }
82}

Referenced by DrvLineTo().

◆ vgaSEtoNW()

static void FASTCALL vgaSEtoNW ( IN CLIPOBJ Clip,
IN BRUSHOBJ Brush,
IN LONG  x,
IN LONG  y,
IN LONG  deltax,
IN LONG  deltay 
)
static

Definition at line 223 of file lineto.c.

230{
231 int i;
232 int error;
233 BOOLEAN EnumMore;
234 PRECTL ClipRect;
235 RECT_ENUM RectEnum;
236 ULONG Pixel = Brush->iSolidColor;
237 LONG delta;
238
240 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
241 ClipRect = RectEnum.arcl;
242 delta = max(deltax, deltay);
243 i = 0;
244 error = delta / 2;
245 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
246 {
247 while ((ClipRect < RectEnum.arcl + RectEnum.c
248 && (y < ClipRect->top
249 || (y < ClipRect->bottom && x < ClipRect->left)))
250 || EnumMore)
251 {
252 if (RectEnum.arcl + RectEnum.c <= ClipRect)
253 {
254 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
255 ClipRect = RectEnum.arcl;
256 }
257 else
258 {
259 ClipRect++;
260 }
261 }
262 if (ClipRect < RectEnum.arcl + RectEnum.c)
263 {
264 if (x < ClipRect->right && y < ClipRect->bottom)
265 vgaPutPixel(x, y, Pixel);
266 if (deltax < deltay)
267 {
268 y--;
269 error = error + deltax;
270 if (deltay <= error)
271 {
272 x--;
273 error = error - deltay;
274 }
275 }
276 else
277 {
278 x--;
279 error = error + deltay;
280 if (deltax <= error)
281 {
282 y--;
283 error = error - deltax;
284 }
285 }
286 i++;
287 }
288 }
289}
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 DrvLineTo().

◆ vgaSWtoNE()

static void FASTCALL vgaSWtoNE ( IN CLIPOBJ Clip,
IN BRUSHOBJ Brush,
IN LONG  x,
IN LONG  y,
IN LONG  deltax,
IN LONG  deltay 
)
static

Definition at line 85 of file lineto.c.

92{
93 int i;
94 int error;
95 BOOLEAN EnumMore;
96 PRECTL ClipRect;
97 RECT_ENUM RectEnum;
98 ULONG Pixel = Brush->iSolidColor;
99 LONG delta;
100
102 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
103 ClipRect = RectEnum.arcl;
104 delta = max(deltax, deltay);
105 i = 0;
106 error = delta / 2;
107 while (i < delta && (ClipRect < RectEnum.arcl + RectEnum.c || EnumMore))
108 {
109 while ((ClipRect < RectEnum.arcl + RectEnum.c
110 && (y < ClipRect->top
111 || (y < ClipRect->bottom && ClipRect->right <= x)))
112 || EnumMore)
113 {
114 if (RectEnum.arcl + RectEnum.c <= ClipRect)
115 {
116 EnumMore = CLIPOBJ_bEnum(Clip, (ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
117 ClipRect = RectEnum.arcl;
118 }
119 else
120 {
121 ClipRect++;
122 }
123 }
124 if (ClipRect < RectEnum.arcl + RectEnum.c)
125 {
126 if (ClipRect->left <= x && y < ClipRect->bottom)
127 vgaPutPixel(x, y, Pixel);
128 if (deltax < deltay)
129 {
130 y--;
131 error = error + deltax;
132 if (deltay <= error)
133 {
134 x++;
135 error = error - deltay;
136 }
137 }
138 else
139 {
140 x++;
141 error = error + deltay;
142 if (deltax <= error)
143 {
144 y--;
145 error = error - deltax;
146 }
147 }
148 i++;
149 }
150 }
151}
#define CD_RIGHTUP
Definition: winddi.h:1323

Referenced by DrvLineTo().