[RESEND] Re: faster 8bpp to 24 bit depth conversion in SetImageBits_8

Vedran Rodic vedran at renata.irb.hr
Sun Mar 4 09:29:23 CST 2001


On Sun, Mar 04, 2001 at 01:51:16PM +0100, Ove Kaaven wrote:
>
>
> 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.
>
> 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.
 
Thanks. Fixed patch attached. I did change left multiplicator from 2 to 4 in
my earlier patches, but I forgot to include it in my final patch being 3 AM
and so... I'll try to be more careful next time.

Vedran



-------------- next part --------------
Index: graphics/x11drv/dib.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/dib.c,v
retrieving revision 1.72
diff -u -r1.72 dib.c
--- graphics/x11drv/dib.c	2001/02/13 20:16:46	1.72
+++ graphics/x11drv/dib.c	2001/03/04 01:01:18
@@ -978,6 +978,35 @@
 	}
 	break;
 #endif
+    case 24:
+#if defined(__i386__) && defined(__GNUC__)
+	if (lines && (dstwidth!=left) && (bmpImage->bits_per_pixel == 32))
+	{
+	    for (h = lines ; h--; ) {
+		int _cl1,_cl2; /* temp outputs for asm below */
+		/* Borrowed from DirectDraw */
+		__asm__ __volatile__(
+		"xor %%eax,%%eax\n"
+		"cld\n"
+		"1:\n"
+		"    lodsb\n"
+		"    movl (%%edx,%%eax,4),%%eax\n"
+		"    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*4),
+		 "c" (dstwidth-left),
+		 "d" (colors)
+		:"eax", "cc", "memory"
+		);
+		bits = (srcbits += linebytes) + left;
+	    }
+	    return;
+	}
+	break;
+#endif
     default:
     	break; /* use slow generic case below */
     }


More information about the wine-devel mailing list