GetPixel bug!!!

François Gouget fgouget at codeweavers.com
Fri Feb 16 02:13:32 CST 2001


   Ignore the previous patch, it is wrong.

   Lock, Unlock... the implications are obvious.

   I just wanted to avoid copying the pixmap back into the DIB for the
GetPixel case since obviously it has not been modified. That's what
commit is here for of course. OTOH the subtleties of lossy are a bit
lost on me. AFAICS it's always set to false so I'll just do the same.



Changelog:

   François Gouget <fgouget at codeweavers.com>

 * graphics/x11drv/graphics.c

   Added DIB/pixmap synchronization for {Get,Set}Pixel



-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: graphics/x11drv/graphics.c
===================================================================
RCS file: /home/cvs/wine/wine/graphics/x11drv/graphics.c,v
retrieving revision 1.36
diff -u -r1.36 graphics.c
--- graphics/x11drv/graphics.c	2001/01/24 19:38:11	1.36
+++ graphics/x11drv/graphics.c	2001/02/16 07:45:41
@@ -864,15 +864,18 @@
     x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y );
     y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y );
     pixel = X11DRV_PALETTE_ToPhysical( dc, color );
-    
+
+    /* Update the pixmap from the DIB section */
+    X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE);
+
+    /* inefficient but simple... */
     TSXSetForeground( display, physDev->gc, pixel );
     TSXSetFunction( display, physDev->gc, GXcopy );
     TSXDrawPoint( display, physDev->drawable, physDev->gc, x, y );
 
-    /* inefficient but simple... */
+    /* Update the DIBSection from the pixmap */
+    X11DRV_UnlockDIBSection(dc, TRUE);
 
-    /* FIXME: the DIBSection pixel should be updated too */
-    
     return X11DRV_PALETTE_ToLogical(pixel);
 }
 
@@ -888,6 +891,9 @@
     int pixel;
     X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
 
+    /* Update the pixmap from the DIB section */
+    X11DRV_LockDIBSection(dc, DIB_Status_GdiMod, FALSE);
+
     x = dc->DCOrgX + INTERNAL_XWPTODP( dc, x, y );
     y = dc->DCOrgY + INTERNAL_YWPTODP( dc, x, y );
     wine_tsx11_lock();
@@ -909,6 +915,10 @@
     pixel = XGetPixel( image, 0, 0 );
     XDestroyImage( image );
     wine_tsx11_unlock();
+
+    /* Update the DIBSection from the pixmap */
+    X11DRV_UnlockDIBSection(dc, FALSE);
+
     return X11DRV_PALETTE_ToLogical(pixel);
 }
 


More information about the wine-patches mailing list