Having trouble here .. Im making a polygon filler, and I'm having trouble

scanning the sides of it. I started coding optimized right at the begining, but

as probelms started to surface, i did it as simple as possible, using real's and

all, but it still wont work. So, I guess I'm doing something fundamentally

wrong. The rutine is included here.. Its supposed to be able to draw lines with

only one X pixel for every Y line. This -should- be simple.. argh!

I'd appreciate a fix for it, preforably -with- an explenaiton :)

-------- CUT --------

Procedure SwapInt(var a,b:Integer);

Var C : Integer;

Begin

c:=a;

a:=b;

b:=c;

End;

Procedure ScanLine(x1,y1,x2,y2,c:Integer);

Var Step : Real;

Xcount: Real;

Teller: Integer;

Begin

If Y1=Y2 then Exit;

If Y2<Y1 then

Begin

SwapInt(Y1,Y2);

SwapInt(X1,X2);

End;

Step:=(X2-X1)/(Y2-Y1);

XCount:=Step;

For Teller:=Y1+1 to Y2 do

Begin

Mem[$a000:Round(XCount)+Teller*320]:=C;

XCount:=XCount+Step;

End;

End;

-------- CUT --------

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

Kim Robert Blix ( kb...@sn.no & http://home.sn.no/~kblix )