[cairo-commit] 3 commits - INSTALL src/cairo-image-surface.c src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Oct 10 13:23:22 PDT 2008


 INSTALL                   |    1 +
 src/cairo-image-surface.c |    3 ++-
 src/cairo-xlib-surface.c  |   37 ++++++++++++++++++++++++-------------
 3 files changed, 27 insertions(+), 14 deletions(-)

New commits:
commit a16ef6ead2b02120ca482aa3d2667e51b0c67e78
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 10 18:03:49 2008 +0100

    [INSTALL] Mention pkg-config requirement
    
    Mention that building the configure script requires at least version 0.16
    of pkg-config.
    
    See the old bug:
      Bug 4702 PKG_PROG_PKG_CONFIG: command not found
      (https://bugs.freedesktop.org/show_bug.cgi?id=4702)

diff --git a/INSTALL b/INSTALL
index 1ee0f48..9db68de 100644
--- a/INSTALL
+++ b/INSTALL
@@ -160,6 +160,7 @@ order to compile cairo. Specifically, you need the following utilities:
 	autoheader
 	aclocal
 	libtoolize
+	pkg-config [at least version 0.16]
 	gtk-doc (recommended)
 
 Hopefully your platform of choice has packages readily available so
commit eba9d87d541d89804f70e56874538a249de08502
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 10 16:51:07 2008 +0100

    [image] Warn about a potential NULL return after finish().
    
    Improve the wording as suggested by
      https://bugs.freedesktop.org/show_bug.cgi?id=12659
    to warn about the possibility of returning NULL even if the passed in
    surface was an image surface.

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index daae8d1..3cb4ccc 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -523,7 +523,8 @@ _cairo_image_surface_create_for_data_with_content (unsigned char	*data,
  * inspection or modification.
  *
  * Return value: a pointer to the image data of this surface or %NULL
- * if @surface is not an image surface.
+ * if @surface is not an image surface, or if cairo_surface_finish()
+ * has been called.
  *
  * Since: 1.2
  **/
commit ac3e4b4bea574c94de77ec15878d116b619ee3f4
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 10 14:00:32 2008 +0100

    [xlib] Disable XRender support if the surface has no xrender_format
    
    Bug 11734:
      XRender crashes due to NULL pointer from Cairo on SGI O2
      (https://bugs.freedesktop.org/show_bug.cgi?id=1173)
    is an example of a case where we try to perform an XRender operation on a
    surface with a format that was not supported by the XRender extension. By
    marking the extension version as -1 on those surfaces, the current checks
    for SURFACE_RENDER_HAS_* always correctly return false and prevent us try
    to create a Picture with a NULL xrender_format.

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 4f526c1..7de1031 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1561,17 +1561,17 @@ _recategorize_composite_operation (cairo_xlib_surface_t	      *dst,
 	_cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL);
     cairo_bool_t needs_alpha_composite;
 
-    if (!_cairo_surface_is_xlib (&src->base))
+    if (! _cairo_surface_is_xlib (&src->base))
 	return DO_UNSUPPORTED;
 
     needs_alpha_composite =
 	_operator_needs_alpha_composite (op, _surface_has_alpha (src));
 
-    if (!have_mask &&
+    if (! have_mask &&
 	is_integer_translation &&
 	src_attr->extend == CAIRO_EXTEND_NONE &&
-	!needs_alpha_composite &&
-	_surfaces_compatible(src, dst))
+	! needs_alpha_composite &&
+	_surfaces_compatible (src, dst))
     {
 	return DO_XCOPYAREA;
     }
@@ -1581,8 +1581,8 @@ _recategorize_composite_operation (cairo_xlib_surface_t	      *dst,
 	src_attr->extend == CAIRO_EXTEND_REPEAT &&
 	(src->width != 1 || src->height != 1))
     {
-	if (!have_mask &&
-	    !needs_alpha_composite &&
+	if (! have_mask &&
+	    ! needs_alpha_composite &&
 	    _surfaces_compatible (dst, src))
 	{
 	    return DO_XTILE;
@@ -1591,10 +1591,10 @@ _recategorize_composite_operation (cairo_xlib_surface_t	      *dst,
 	return DO_UNSUPPORTED;
     }
 
-    if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src))
+    if (! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src))
 	return DO_UNSUPPORTED;
 
-    if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
+    if (! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst))
 	return DO_UNSUPPORTED;
 
     return DO_RENDER;
@@ -1686,7 +1686,10 @@ _cairo_xlib_surface_composite (cairo_operator_t		op,
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
 	goto BAIL;
     }
-    if (mask != NULL && !_cairo_surface_is_xlib (&mask->base)) {
+    if (mask != NULL &&
+	(! _cairo_surface_is_xlib (&mask->base) ||
+	 ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)))
+    {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
 	goto BAIL;
     }
@@ -1872,7 +1875,7 @@ _cairo_xlib_surface_fill_rectangles (void		     *abstract_surface,
 
     _cairo_xlib_display_notify (surface->screen_info->display);
 
-    if (!CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES (surface)) {
+    if (! CAIRO_SURFACE_RENDER_HAS_FILL_RECTANGLES (surface)) {
 	if (op == CAIRO_OPERATOR_CLEAR ||
 	    ((op == CAIRO_OPERATOR_SOURCE || op == CAIRO_OPERATOR_OVER) &&
 	     CAIRO_COLOR_IS_OPAQUE (color)))
@@ -2055,7 +2058,8 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t	op,
     if (status)
 	return status;
 
-    operation = _recategorize_composite_operation (dst, op, src, &attributes, TRUE);
+    operation = _recategorize_composite_operation (dst, op, src,
+						   &attributes, TRUE);
     if (operation == DO_UNSUPPORTED) {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
 	goto BAIL;
@@ -2505,6 +2509,12 @@ _cairo_xlib_surface_create_internal (Display		       *dpy,
 	xrender_format = NULL;
     }
 
+    /* we cannot use XRender for this surface, so ensure we don't try */
+    if (xrender_format == NULL) {
+	surface->render_major = -1;
+	surface->render_minor = -1;
+    }
+
     _cairo_surface_init (&surface->base, &cairo_xlib_surface_backend,
 			 _xrender_format_to_content (xrender_format));
 
@@ -3876,7 +3886,7 @@ _cairo_xlib_surface_show_glyphs (void                *abstract_dst,
 
     cairo_solid_pattern_t solid_pattern;
 
-    if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT (dst) || !dst->xrender_format)
+    if (! CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT (dst))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
     /* Just let unbounded operators go through the fallback code
@@ -3962,7 +3972,8 @@ _cairo_xlib_surface_show_glyphs (void                *abstract_dst,
 	    goto BAIL0;
     }
 
-    operation = _recategorize_composite_operation (dst, op, src, &attributes, TRUE);
+    operation = _recategorize_composite_operation (dst, op, src,
+						   &attributes, TRUE);
     if (operation == DO_UNSUPPORTED) {
 	status = CAIRO_INT_STATUS_UNSUPPORTED;
 	goto BAIL1;


More information about the cairo-commit mailing list