Is there any chance or interest in having line drawing in the SDL library?
I’d be happy to SDL-ize it and submit it to the library. Obviously, I’d
have to make 8bpp, 24bpp, and 32bpp versions of the routines as well as
include my translucency and “normal” linedraws and of course clipping.
I tried WU antialiasing but it really looks bad. One side of the line
looks great, the other is just as stairstepped as the original
nonantialiased line. Yuck.
Anyway, this routine is only about 15% slower than a regular single pixel
draw, and it also includes gamma correction. The lines look really, really
sharp! Here is a segment when it’s an X major stepping, and I think I’ve
pretty much optimized it to the point it can be optimized, but I’d love
to hear any ideas from other experts in graphics. The only thing I’m
thinking now is that the 16bpp accesses kill the Pentium pipeline…
s32DistX = Distance between X endpoints
s32DistY = Distance between Y endpoints
pu16Buffer = Pointer to 16bpp surface
s32XSrc = Source coordinate (from X)
s32Temp = Y Step * pitch
if (s32DistX > s32DistY)
{
s32XCounter = 0;
s32Step = (s32DistY << 8) / s32DistX;
s32DistX <<= 8;
s32XDest -= s32XSrc;
while (s32XDest)
{
u32Intensity1 = sg_u32GammaPositive[s32XCounter & 0xff];
u32Intensity2 = sg_u32GammaNegative[s32XCounter & 0xff];
*(pu16Buffer - s32Temp) = (((u32Red * u32Intensity2)) & 0xf800) |
(((u32Green * u32Intensity2) >> 8) & 0x07e0) |
((u32Blue * u32Intensity2) >> 8);
*(pu16Buffer) = u16Color;
*(pu16Buffer + s32Temp) = (((u32Red * u32Intensity1)) & 0xf800) |
(((u32Green * u32Intensity1) >> 8) & 0x07e0) |
((u32Blue * u32Intensity1) >> 8);
pu16Buffer += s32XStep;
s32XDest--;
s32XCounter += s32Step;
if (s32XCounter >= 0x100)
{
pu16Buffer += s32Temp;
s32XCounter -= 0x100;
}
}
}
–>Neil-------------------------------------------------------------------------------
Neil Bradley What are burger lovers saying
Synthcom Systems, Inc. about the new BK Back Porch Griller?
ICQ #29402898 “It tastes like it came off the back porch.” - Me