Release 941017
[wine/gsoc-2012-control.git] / objects / linedda.c
blobe61290dab75cc36e029075010da2106cbf65c5c1
1 /*
2 * LineDDA
4 * Copyright 1993 Bob Amstadt
5 */
7 static char Copyright[] = "Copyright Bob Amstadt, 1993";
9 #include <stdlib.h>
10 #include "windows.h"
12 /**********************************************************************
13 * LineDDA (GDI.100)
15 void LineDDA(short nXStart, short nYStart, short nXEnd, short nYEnd,
16 FARPROC callback, long lParam)
18 int x, y;
19 int b;
20 int x_diff = nXEnd - nXStart;
21 int y_diff = nYEnd - nYStart;
23 if (x_diff == 0 && y_diff == 0)
24 return;
26 if ((abs(x_diff) < abs(y_diff) && x_diff != 0) || y_diff == 0)
28 b = (nXStart * y_diff) / x_diff - nYStart;
30 for (x = nXStart; x <= nXEnd; x++)
32 y = (x * y_diff) / x_diff + b;
33 CallLineDDAProc(callback, x, y, lParam);
36 else
38 b = (nYStart * x_diff) / y_diff - nXStart;
40 for (y = nYStart; y <= nYEnd; y++)
42 x = (y * x_diff) / y_diff + b;
43 CallLineDDAProc(callback, x, y, lParam);