Mail Archives: djgpp/1997/07/18/21:03:06
>I'm looking for a 24-bpp putpixel function (perferably AT&T ASM, but I
>can convert from C or Intel ASM). I tried a very simple one:
This is what I do (24-bpp is a pain in the ass)
void _putpixel24 (SURFACE* surface, int x, int y, long color)
{
asm ("andl $0x00FFFFFF,%%eax \n\t" /* restrict it to lower 3
bytes */
"andl $0xFF000000,(%%edx) \n\t" /* zero out video memory */
"orl %%eax,(%%edx) \n\t" /* or it with video memory */
:
: "a" (color),
"d" (surface->offset + y * surface->bytesperline + x * 3)
: "eax", "edx");
}
This is very slow but it works. Actually just use Shawn's code. Much
better. Just thought I'd throw in someting else for flavor and what
not to do in high speed performance programming. There are 2 read's
and 2 write's here to memory and if the address is not properly
aligned this code is horribly slow. Oh well. It works but I need to
fix it.
Lonnie McCullough
lonniem AT cs DOT utexas DOT edu
- Raw text -