Re: [AD] clipping line algorithm

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


I have fixed up your version so that it compiles[ you were right, it
didnt compile as is ;) ]. Performance was vastly improved using vline
and hline. Clipline now performs almost the same as line when no
clipping must be performed. Tests show clipline actually performs faster
than line even when no clipping is performed, I dont know why though.
Attached is clipline3 and the main loop I used to benchmark it with. 

On Fri, 12 Sep 2003 08:22:50 +0200
Eric Botcazou <ebotcazou@xxxxxxxxxx> wrote:

> > 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: clipline3.c.gz
Description: Binary data

Attachment: main.cpp.gz
Description: Binary data



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