Release 941227
[wine/dcerpc.git] / objects / linedda.c
blob729f9ec26a80295525fade77b553c19a959c0154
1 /*
2 * LineDDA
4 * Copyright 1993 Bob Amstadt
6 static char Copyright[] = "Copyright Bob Amstadt, 1993";
7 */
9 #include <stdlib.h>
10 #include "windows.h"
11 #include "if1632.h"
13 /**********************************************************************
14 * LineDDA (GDI.100)
16 void LineDDA(short nXStart, short nYStart, short nXEnd, short nYEnd,
17 FARPROC callback, long lParam)
19 int x, y;
20 int b;
21 int x_diff = nXEnd - nXStart;
22 int y_diff = nYEnd - nYStart;
24 if (x_diff == 0 && y_diff == 0)
25 return;
27 if ((abs(x_diff) < abs(y_diff) && x_diff != 0) || y_diff == 0)
29 b = (nXStart * y_diff) / x_diff - nYStart;
31 for (x = nXStart; x <= nXEnd; x++)
33 y = (x * y_diff) / x_diff + b;
34 CallLineDDAProc(callback, x, y, lParam);
37 else
39 b = (nYStart * x_diff) / y_diff - nXStart;
41 for (y = nYStart; y <= nYEnd; y++)
43 x = (y * x_diff) / y_diff + b;
44 CallLineDDAProc(callback, x, y, lParam);