Colour problems with latest DIB fix

Gerard Patel gerard.patel at nerim.net
Sun Oct 28 14:17:06 CST 2001


At 02:18 PM 21/10/2001 -0700, you wrote:
>
>Johan Gill wrote:
>> 
>> Since the big DIB fix, red and blue are exchanged in some cases,
>> for example in the install program for The Sims.
>> 
>> This happens in both depth 16 and depth 24.
>
>   Could you give me some more information about your X server (version,
>driver)?

I see a very similar problem with my X server : 4.03 that comes with my
Mandrake 8,
graphic card is a Sis 6326.

I had tested your patch before it was committed BTW but I failed to notice
the problem :-/

Anyway, the attached patch is displaying the failing picture correctly.
What do you think ?

Gerard


-------------- next part --------------
--- dib.c.orig	Thu Oct 18 01:10:48 2001
+++ dib.c	Sun Oct 28 20:09:28 2001
@@ -1013,22 +1013,22 @@
         dstpixel=dstbits;
         for (x=0; x<width; x++) {
             /* Do 4 pixels at a time: 3 dwords in and 4 words out */
-            DWORD srcval1,srcval2;
-            srcval1=srcpixel[0];
-            dstpixel[0]=((srcval1 <<  8) & 0xf800) | /* l1 */
-                        ((srcval1 >>  5) & 0x07e0) | /* g1 */
-                        ((srcval1 >> 19) & 0x001f);  /* h1 */
-            srcval2=srcpixel[1];
-            dstpixel[1]=((srcval1 >> 16) & 0xf800) | /* l2 */
-                        ((srcval2 <<  3) & 0x07e0) | /* g2 */
-                        ((srcval2 >> 11) & 0x001f);  /* h2 */
-            srcval1=srcpixel[2];
-            dstpixel[2]=((srcval2 >>  8) & 0xf800) | /* l3 */
-                        ((srcval2 >> 21) & 0x07e0) | /* g3 */
-                        ((srcval1 >>  3) & 0x001f);  /* h3 */
-            dstpixel[3]=(srcval1         & 0xf800) | /* l4 */
-                        ((srcval1 >> 13) & 0x07e0) | /* g4 */
-                        ((srcval1 >> 27) & 0x001f);  /* h4 */
+            DWORD srcval0,srcval1,srcval2;
+            srcval0=srcpixel[0];
+            dstpixel[0]=((srcval0 >>  8) & 0xf800) | /* l1 */
+                        ((srcval0 >>  5) & 0x07e0) | /* g1 */
+                        ((srcval0 >>  3) & 0x001f);  /* h1 */
+            srcval1=srcpixel[1];
+            dstpixel[1]=((srcval0 >> 27) & 0x001f) | /* l2 */
+                        ((srcval1 <<  3) & 0x07e0) | /* g2 */
+                        (srcval1         & 0xf800);  /* h2 */
+            srcval2=srcpixel[2];
+            dstpixel[2]=((srcval1 >> 19) & 0x001f) | /* l3 */
+                        ((srcval1 >> 21) & 0x07e0) | /* g3 */
+                        ((srcval2 <<  8) & 0xf800);  /* h3 */
+            dstpixel[3]=((srcval2 >> 16) & 0xf800) | /* l4 */
+                        ((srcval2 >> 13) & 0x07e0) | /* g4 */
+                        ((srcval2 >> 11) & 0x001f);  /* h4 */
             srcpixel+=3;
             dstpixel+=4;
         }
@@ -1036,9 +1036,9 @@
         srcbyte=(LPBYTE)srcpixel;
         for (x=0; x<oddwidth; x++) {
             WORD dstval;
-            dstval =((srcbyte[0] << 8) & 0xf800);    /* l */
+            dstval =((srcbyte[2] << 8) & 0xf800);    /* l */
             dstval|=((srcbyte[1] << 3) & 0x07e0);    /* g */
-            dstval|=((srcbyte[2] >> 3) & 0x001f);    /* h */
+            dstval|=((srcbyte[0] >> 3) & 0x001f);    /* h */
             *dstpixel++=dstval;
             srcbyte+=3;
         }
-------------- next part --------------



More information about the wine-devel mailing list