summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/x11/xm_span.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/x11/xm_span.c')
-rw-r--r--src/mesa/drivers/x11/xm_span.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c
index 57b5749448..309cefcb8e 100644
--- a/src/mesa/drivers/x11/xm_span.c
+++ b/src/mesa/drivers/x11/xm_span.c
@@ -471,8 +471,26 @@ static void put_row_8R8G8B_pixmap( PUT_ROW_ARGS )
if (mask) {
for (i=0;i<n;i++,x++) {
if (mask[i]) {
+#if 1
+ /*
+ * XXX Something funny is going on here.
+ * If we're drawing into a window that uses a depth 32 TrueColor
+ * visual, we see the right pixels on screen, but when we read
+ * them back with XGetImage() we get random colors.
+ * The alternative code below which uses XPutImage() instead
+ * seems to mostly fix the problem, but not always.
+ * We don't normally create windows with this visual, but glean
+ * does and we're seeing some failures there.
+ */
XMesaSetForeground( dpy, gc, PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] ));
XMesaDrawPoint( dpy, buffer, gc, (int) x, (int) y );
+#else
+ /* This code works more often, but not always */
+ XMesaImage *rowimg = XMESA_BUFFER(ctx->DrawBuffer)->rowimage;
+ GLuint *ptr4 = (GLuint *) rowimg->data;
+ *ptr4 = PACK_8R8G8B( rgba[i][RCOMP], rgba[i][GCOMP], rgba[i][BCOMP] );
+ XMesaPutImage( dpy, buffer, gc, rowimg, 0, 0, x, y, 1, 1 );
+#endif
}
}
}