ReactOS 0.4.15-dev-8127-g6338913
linedda.c File Reference
#include <precomp.h>
#include <debug.h>
Include dependency graph for linedda.c:

Go to the source code of this file.

Functions

BOOL WINAPI LineDDA (INT nXStart, INT nYStart, INT nXEnd, INT nYEnd, LINEDDAPROC callback, LPARAM lParam)
 

Function Documentation

◆ LineDDA()

BOOL WINAPI LineDDA ( INT  nXStart,
INT  nYStart,
INT  nXEnd,
INT  nYEnd,
LINEDDAPROC  callback,
LPARAM  lParam 
)

Definition at line 40 of file linedda.c.

42{
43 INT xadd = 1, yadd = 1;
44 INT err,erradd;
45 INT cnt;
46 INT dx = nXEnd - nXStart;
47 INT dy = nYEnd - nYStart;
48
49 if (dx < 0)
50 {
51 dx = -dx;
52 xadd = -1;
53 }
54 if (dy < 0)
55 {
56 dy = -dy;
57 yadd = -1;
58 }
59 if (dx > dy) /* line is "more horizontal" */
60 {
61 err = 2*dy - dx;
62 erradd = 2*dy - 2*dx;
63 for(cnt = 0; cnt < dx; cnt++)
64 {
65 callback(nXStart,nYStart,lParam);
66 if (err > 0)
67 {
68 nYStart += yadd;
69 err += erradd;
70 }
71 else err += 2*dy;
72 nXStart += xadd;
73 }
74 }
75 else /* line is "more vertical" */
76 {
77 err = 2*dx - dy;
78 erradd = 2*dx - 2*dy;
79 for(cnt = 0; cnt < dy; cnt++)
80 {
81 callback(nXStart,nYStart,lParam);
82 if (err > 0)
83 {
84 nXStart += xadd;
85 err += erradd;
86 }
87 else err += 2*dx;
88 nYStart += yadd;
89 }
90 }
91 return TRUE;
92}
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
GLint dy
Definition: linetemp.h:97
GLint dx
Definition: linetemp.h:97
static IPrintDialogCallback callback
Definition: printdlg.c:326
#define err(...)
int32_t INT
Definition: typedefs.h:58