This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why doesn't work

void drawline2(char x1,char y1,char x2,char y2)
{
char i, deltax, deltay, numpixels;
char d, dinc1, dinc2;
char x, xinc1, xinc2;
char y, yinc1, yinc2;

deltax = abs(x2 - x1);
deltay = abs(y2 - y1);


if(deltax >= deltay)
{

numpixels = deltax + 1;
d = (2 * deltay) - deltax;
dinc1 = deltay << 1;
dinc2 = (deltay - deltax) << 1;
xinc1 = 1;
xinc2 = 1;
yinc1 = 0;
yinc2 = 1;
}
else
{

numpixels = deltay + 1;
d = (2 * deltax) - deltay;
dinc1 = deltax << 1;
dinc2 = (deltax - deltay) << 1;
xinc1 = 0;
yinc2 = 1;
xinc2 = 1;
yinc1 = 1;

}

if(x1 > x2)
{
xinc1 = -xinc1;
xinc2 = -xinc2;
}
if(y1 > y2)
{
yinc1 = -yinc1;
yinc2 = -yinc2;
}
x = x1;
y = y1;

for(i = 1; i < numpixels; i++)
{
drawbyte2(x, y, 0xfe);
if(d < 0)
{
d = d + dinc1;
x = x + xinc1;
y = y + yinc1;
}
else
{
d = d + dinc2;
x = x + xinc2;
y = y + yinc2;
}
}
}

0