Corrected the problem where a tab control marked multiline but has
[wine.git] / objects / linedda.c
blob44615c59fd88eb102be9369bcb5a17867d281203
1 /*
2 * LineDDA
4 * Copyright 1993 Bob Amstadt
5 */
7 #include <stdlib.h>
8 #include "windef.h"
9 #include "wingdi.h"
10 #include "wine/wingdi16.h"
13 /**********************************************************************
14 * LineDDA (GDI32.248)
16 BOOL WINAPI LineDDA(INT nXStart, INT nYStart, INT nXEnd, INT nYEnd,
17 LINEDDAPROC callback, LPARAM lParam )
19 INT xadd = 1, yadd = 1;
20 INT err,erradd;
21 INT cnt;
22 INT dx = nXEnd - nXStart;
23 INT dy = nYEnd - nYStart;
25 if (dx < 0) {
26 dx = -dx; xadd = -1;
28 if (dy < 0) {
29 dy = -dy; yadd = -1;
31 if (dx > dy) { /* line is "more horizontal" */
32 err = 2*dy - dx; erradd = 2*dy - 2*dx;
33 for(cnt = 0;cnt <= dx; cnt++) {
34 callback(nXStart,nYStart,lParam);
35 if (err > 0) {
36 nYStart += yadd;
37 err += erradd;
38 } else {
39 err += 2*dy;
41 nXStart += xadd;
43 } else { /* line is "more vertical" */
44 err = 2*dx - dy; erradd = 2*dx - 2*dy;
45 for(cnt = 0;cnt <= dy; cnt++) {
46 callback(nXStart,nYStart,lParam);
47 if (err > 0) {
48 nXStart += xadd;
49 err += erradd;
50 } else {
51 err += 2*dx;
53 nYStart += yadd;
56 return TRUE;