Re: [AD] clipping line algorithm

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I did benchmark it and my function came out on top.

Sure, but your version cheats because it calls _putpixel directly. I'd like 
to have a fair benchmark against the current line().

> clipline performs slightly worse when all the lines are within the bitmap
> to begin with, so it should be used only when the user knows the line has a 
> chance of going way outside the bitmap.

According to your code, the slowdown can't be significant since your 
algorithm performs the same operations as the current implementation in that 
case. I think it would only be a matter of local optimizations to recover 
the loss, and we don't care about them for the time being.

> Is this another hint to correct my mistakes and resend it or will you make
> these changes? Ill go ahead and make the changes myself, but you can add
> some of your own. :)

I've attached the sketch of the version I'm willing to accept for the next 
WIP release (it's only a sketch, it probably doesn't compile). Clean it up 
and benchmark it again; if the results are still good, I'll replace the 
current line() implementation by your version.

-- 
Eric Botcazou

Attachment: clipline2.c.gz
Description: GNU Zip compressed data



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/