faster 8bpp to 24 bit depth conversion in SetImageBits_8

Ove Kaaven ovehk at ping.uio.no
Sun Mar 4 06:51:16 CST 2001


On Sun, 4 Mar 2001, Vedran Rodic wrote:

> ChangeLog entry:
>  
> Made 8 bpp to 24 bit depth conversion in X11DRV_DIB_SetImageBits_8
> faster by using inline asm.

There are still a couple of mistakes here, though...

> +               __asm__ __volatile__(
> +               "xor %%eax,%%eax\n"
> +               "cld\n"
> +               "1:\n"
> +               "    lodsb\n"
> +               "    movl (%%edx,%%eax,4),%%ax\n"

Since this is a 32-bit move (movl), you should use %%eax, not %%ax. The
assembler doesn't complain about this now, but technically it should, and
might someday.

> +               "    stosl\n"
> +               "      xor %%eax,%%eax\n"
> +               "    loop 1b\n"
> +               :"=S" (bits), "=D" (_cl1), "=c" (_cl2)
> +               :"S" (bits),
> +                "D" (bmpImage->data+h*bmpImage->bytes_per_line+left*2),

Since you're converting to 32bpp, not 16bpp, you should multiply "left" by
4, not by 2, or strange things may happen in some apps.

> +                "c" (dstwidth-left),
> +                "d" (colors)
> +               :"eax", "cc", "memory"





More information about the wine-patches mailing list