[cairo-commit] 2 commits - src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Feb 1 18:09:07 PST 2012


 src/cairo-xlib-surface.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit c6c02f519457299909c76cd116f6392c6d0e3a84
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 2 02:06:45 2012 +0000

    xlib: Only reduce a readback of an uninitialised source for pixmaps
    
    For a foreign drawable, we have to assume to that is dirty upon creation
    or otherwise we fail to read back the correct pixel data when copying to
    an image.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 3e0bed7..5fb9185 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -693,7 +693,9 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
     assert (extents->x + extents->width <= surface->width);
     assert (extents->y + extents->height <= surface->height);
 
-    if (surface->base.serial == 0) {
+    if (surface->base.is_clear ||
+	(surface->base.serial == 0 && surface->owns_pixmap))
+    {
 	xlib_masks.bpp = bits_per_pixel (surface);
 	xlib_masks.alpha_mask = surface->a_mask;
 	xlib_masks.red_mask = surface->r_mask;
commit 24445f94684a10eeaebb3794dc7c4b20539d873b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 2 01:46:56 2012 +0000

    xlib: Set IncludeInferiors when acquiring the source image
    
    If we need to fallback and perform a copy first to a pixmap for a
    partially unviewable Window, we need to copy its inferiors as well.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 573bed1..3e0bed7 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -758,11 +758,19 @@ _get_image_surface (cairo_xlib_surface_t    *surface,
 				extents->width, extents->height,
 				surface->depth);
 	if (pixmap) {
+	    XGCValues gcv;
+
+	    gcv.subwindow_mode = IncludeInferiors;
+	    XChangeGC (display->display, gc, GCSubwindowMode, &gcv);
+
 	    XCopyArea (display->display, surface->drawable, pixmap, gc,
 		       extents->x, extents->y,
 		       extents->width, extents->height,
 		       0, 0);
 
+	    gcv.subwindow_mode = ClipByChildren;
+	    XChangeGC (display->display, gc, GCSubwindowMode, &gcv);
+
 	    ximage = XGetImage (display->display,
 				pixmap,
 				0, 0,


More information about the cairo-commit mailing list