Re: [AD] clipping line algorithm |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
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().
>
I was under the impression that _putpixel assumed the coordinates were
within the bitmap. If this is the case, you cannot give _putpixel to the
normal line function becuase it will crash when writing pixels outside
the bitmap. clipline guarantees all pixels will be inside the bitmap and
this is why I used it. Am I wrong about _putpixel?
Also, what exactly is the difference between putpixel and
bmp->vtable->putpixel?
> > 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.
>
I dont see to many optimizations that can be made. Maybe its a good time
for some of Bob's optimization tricks or Bob himself should optimize it.