[cairo-commit] 3 commits - src/cairo-clip-private.h src/cairo-xcb-private.h src/cairo-xcb-surface.c src/cairo-xlib-core-compositor.c src/cairo-xlib-render-compositor.c src/cairo-xlib-xcb-surface.c

Uli Schlachter psychon at kemper.freedesktop.org
Wed Sep 14 07:26:29 PDT 2011


 src/cairo-clip-private.h           |    2 --
 src/cairo-xcb-private.h            |    1 -
 src/cairo-xcb-surface.c            |   24 +++++++++++-------------
 src/cairo-xlib-core-compositor.c   |    4 ++++
 src/cairo-xlib-render-compositor.c |    4 ++++
 src/cairo-xlib-xcb-surface.c       |   26 ++++++--------------------
 6 files changed, 25 insertions(+), 36 deletions(-)

New commits:
commit e3131242b25d2d875f1e725f74912fadc8cd43d5
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Sep 14 15:50:19 2011 +0200

    xlib-xcb: Make this compile again
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xlib-core-compositor.c b/src/cairo-xlib-core-compositor.c
index 4d59c1f..fe871ab 100644
--- a/src/cairo-xlib-core-compositor.c
+++ b/src/cairo-xlib-core-compositor.c
@@ -46,6 +46,8 @@
 
 #include "cairoint.h"
 
+#if !CAIRO_HAS_XLIB_XCB_FUNCTIONS
+
 #include "cairo-xlib-private.h"
 #include "cairo-xlib-surface-private.h"
 
@@ -522,3 +524,5 @@ _cairo_xlib_core_compositor_get (void)
 
     return &compositor;
 }
+
+#endif /* !CAIRO_HAS_XLIB_XCB_FUNCTIONS */
diff --git a/src/cairo-xlib-render-compositor.c b/src/cairo-xlib-render-compositor.c
index 6e53f13..60d9984 100644
--- a/src/cairo-xlib-render-compositor.c
+++ b/src/cairo-xlib-render-compositor.c
@@ -42,6 +42,8 @@
 
 #include "cairoint.h"
 
+#if !CAIRO_HAS_XLIB_XCB_FUNCTIONS
+
 #include "cairo-xlib-private.h"
 
 #include "cairo-compositor-private.h"
@@ -1683,3 +1685,5 @@ _cairo_xlib_traps_compositor_get (void)
 
     return &compositor.base;
 }
+
+#endif /* !CAIRO_HAS_XLIB_XCB_FUNCTIONS */
diff --git a/src/cairo-xlib-xcb-surface.c b/src/cairo-xlib-xcb-surface.c
index db58815..f4ddd97 100644
--- a/src/cairo-xlib-xcb-surface.c
+++ b/src/cairo-xlib-xcb-surface.c
@@ -48,6 +48,7 @@
 
 #include "cairo-default-context-private.h"
 #include "cairo-image-surface-private.h"
+#include "cairo-surface-backend-private.h"
 
 #include <X11/Xlib-xcb.h>
 #include <X11/Xlibint.h>	/* For XESetCloseDisplay */
@@ -119,14 +120,7 @@ _cairo_xlib_xcb_surface_map_to_image (void *abstract_surface,
 				      const cairo_rectangle_int_t *extents)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
-    cairo_rectangle_t rect;
-
-    rect.x = extents->x;
-    rect.y = extents->y;
-    rect.width = extents->width;
-    rect.height = extents->height;
-
-    return cairo_surface_map_to_image (&surface->xcb->base, &rect);
+    return cairo_surface_map_to_image (&surface->xcb->base, extents);
 }
 
 static cairo_int_status_t
@@ -241,11 +235,9 @@ _cairo_xlib_xcb_surface_glyphs (void			*abstract_surface,
 				cairo_glyph_t		*glyphs,
 				int			 num_glyphs,
 				cairo_scaled_font_t	*scaled_font,
-				const cairo_clip_t	*clip,
-				int *num_remaining)
+				const cairo_clip_t	*clip)
 {
     cairo_xlib_xcb_surface_t *surface = abstract_surface;
-    *num_remaining = 0;
     return _cairo_surface_show_text_glyphs (&surface->xcb->base, op, source,
 					    NULL, 0,
 					    glyphs, num_glyphs,
@@ -285,28 +277,22 @@ static const cairo_surface_backend_t _cairo_xlib_xcb_surface_backend = {
 
     _cairo_xlib_xcb_surface_acquire_source_image,
     _cairo_xlib_xcb_surface_release_source_image,
-    NULL, NULL, NULL, /* dest acquire/release/clone */
-
-    NULL, /* composite */
-    NULL, /* fill */
-    NULL, /* trapezoids */
-    NULL, /* span */
-    NULL, /* check-span */
+    NULL, /* snapshot */
 
     NULL, /* copy_page */
     NULL, /* show_page */
+
     _cairo_xlib_xcb_surface_get_extents,
-    NULL, /* old-glyphs */
     _cairo_xlib_xcb_surface_get_font_options,
 
     _cairo_xlib_xcb_surface_flush,
     _cairo_xlib_xcb_surface_mark_dirty,
-    NULL, NULL, /* font/glyph fini */
 
     _cairo_xlib_xcb_surface_paint,
     _cairo_xlib_xcb_surface_mask,
     _cairo_xlib_xcb_surface_stroke,
     _cairo_xlib_xcb_surface_fill,
+    NULL, /* fill_stroke */
     _cairo_xlib_xcb_surface_glyphs,
 };
 
commit af11d26752d73b5530f84478da7cc14a80cd9421
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Sep 3 14:09:58 2011 +0200

    xcb: Remove some dead code
    
    surface->use_pixmap always had the value 0. This code is taken from cairo-xlib.
    However, in cairo-xlib use_pixmap is set to 20 if XGetImage() fails.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-private.h b/src/cairo-xcb-private.h
index 9223d67..c27843a 100644
--- a/src/cairo-xcb-private.h
+++ b/src/cairo-xcb-private.h
@@ -94,7 +94,6 @@ struct _cairo_xcb_surface {
 
     xcb_drawable_t drawable;
     cairo_bool_t owns_pixmap;
-    int use_pixmap;
 
     cairo_bool_t deferred_clear;
     cairo_color_t deferred_clear_color;
diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index fe4d628..67568bd 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -362,18 +362,13 @@ _get_image (cairo_xcb_surface_t		 *surface,
 	}
     }
 
-    if (surface->use_pixmap == 0) {
-	status = _cairo_xcb_connection_get_image (connection,
-						  surface->drawable,
-						  x, y,
-						  width, height,
-						  &reply);
-	if (unlikely (status))
-	    goto FAIL;
-    } else {
-	surface->use_pixmap--;
-	reply = NULL;
-    }
+    status = _cairo_xcb_connection_get_image (connection,
+					      surface->drawable,
+					      x, y,
+					      width, height,
+					      &reply);
+    if (unlikely (status))
+	goto FAIL;
 
     if (reply == NULL && ! surface->owns_pixmap) {
 	/* xcb_get_image_t from a window is dangerous because it can
@@ -381,6 +376,10 @@ _get_image (cairo_xcb_surface_t		 *surface,
 	 * outside the screen. We could check for errors and
 	 * retry, but to keep things simple, we just create a
 	 * temporary pixmap
+	 *
+	 * If we hit this fallback too often, we should remember so and
+	 * skip the round-trip from the above GetImage request,
+	 * similar to what cairo-xlib does.
 	 */
 	xcb_pixmap_t pixmap;
 	xcb_gcontext_t gc;
@@ -915,7 +914,6 @@ _cairo_xcb_surface_create_internal (cairo_xcb_screen_t		*screen,
 
     surface->drawable = drawable;
     surface->owns_pixmap = owns_pixmap;
-    surface->use_pixmap = 0;
 
     surface->deferred_clear = FALSE;
     surface->deferred_clear_color = *CAIRO_COLOR_TRANSPARENT;
commit cd69c8ef68496f6c6c78e375f831a81ac99c12e4
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Sep 3 14:05:44 2011 +0200

    cairo_clip_path_t: Remove extents
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h
index 7cbef24..a682ce4 100644
--- a/src/cairo-clip-private.h
+++ b/src/cairo-clip-private.h
@@ -55,8 +55,6 @@ struct _cairo_clip_path {
     double			 tolerance;
     cairo_antialias_t		 antialias;
     cairo_clip_path_t		*prev;
-
-    cairo_rectangle_int_t extents;
 };
 
 struct _cairo_clip {


More information about the cairo-commit mailing list