pCompositeClip

Jeremy Huddleston jeremyhu at freedesktop.org
Sun Apr 18 04:14:54 PDT 2010


So I've been battling a rather annoying bug rendering borders in XQuartz:

http://xquartz.macosforge.org/trac/ticket/290

Everything works fine when the window is located at the screen origin.  Interestingly, another recent regression also results in some window contents getting clipped as if the clipping bounds were translated to the origin:

https://bugs.freedesktop.org/show_bug.cgi?id=26124

so my assumption is that these two are related.  I've figured out a workaround for the first issue (below) which essentially sets the clipping region in miPaintWindow to the entire screen.  In some runs through, it looks like this clipping region was getting set to (0,0 <window width> x <window height>), and the rects being drawn were in the screen's coordinate system (which is expected).

Now, why would this be happening?

As I did some resizing of the window, I noticed the following:

GC: 0 x:670-870 y:335-535 drawable: 670 335, pWin->drawable: 670 335
GC: 0 x:560-874 y:225-556 drawable: 560 225, pWin->drawable: 560 225
GC: 1 x:0-333 y:0-377 drawable: 0 0, pWin->drawable: 670 335
GC: 0 x:560-893 y:225-580 drawable: 560 225, pWin->drawable: 560 225
GC: 1 x:0-333 y:0-377 drawable: 0 0, pWin->drawable: 670 335
GC: 0 x:560-893 y:225-580 drawable: 560 225, pWin->drawable: 560 225
GC: 0 x:560-910 y:225-598 drawable: 560 225, pWin->drawable: 560 225
GC: 0 x:560-910 y:225-598 drawable: 560 225, pWin->drawable: 560 225

ErrorF("GC: %d x:%d-%d y:%d-%d drawable: %d %d, pWin->drawable: %d %d\n", what,
       pGC->pCompositeClip->extents.x1, pGC->pCompositeClip->extents.x2,
       pGC->pCompositeClip->extents.y1, pGC->pCompositeClip->extents.y2,
       drawable->x, drawable->y, pWin->drawable.x, pWin->drawable.y);

The window I was resizing was from border.c in http://xquartz.macosforge.org/trac/ticket/290

Thanks for the help... now it's time for me to sleep...

--Jeremy

diff --git a/mi/miexpose.c b/mi/miexpose.c
index 6776064..b43777d 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -680,6 +680,19 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 	prect->height = pbox->y2 - pbox->y1;
     }
     prect -= numRects;
+    
+#ifdef XQUARTZ
+    /* Looks like our clipping isn't set right for some reason:
+     * http://xquartz.macosforge.org/trac/ticket/290
+     */
+    if(what == PW_BORDER) {
+	pGC->pCompositeClip->extents.x1 = 0;
+	pGC->pCompositeClip->extents.y1 = 0;
+	pGC->pCompositeClip->extents.x2 = drawable->pScreen->width;
+	pGC->pCompositeClip->extents.y2 = drawable->pScreen->height;
+    }
+#endif
+
     (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect);
     xfree(prect);
 



More information about the xorg-devel mailing list