[cairo-commit] Branch '1.10' - 2 commits - src/cairo-image-surface.c src/Makefile.am

Benjamin Otte company at kemper.freedesktop.org
Wed Jun 8 07:05:20 PDT 2011


 src/Makefile.am           |    4 ++--
 src/cairo-image-surface.c |   23 ++++++++++++++++-------
 2 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit d888e147e37744b4f6956468faa95668dc7f2b57
Author: Dagobert Michelsen <dam at opencsw.org>
Date:   Wed Jun 8 11:16:21 2011 +0200

    Use detected EGREP instead of generic grep
    
    https://bugs.freedesktop.org/show_bug.cgi?id=38069

diff --git a/src/Makefile.am b/src/Makefile.am
index 5edf706..f94e470 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -69,9 +69,9 @@ cairo.def: cairo-features.h $(enabled_cairo_headers)
 	@echo Generating $@
 	@(echo EXPORTS; \
 	(cd $(srcdir); cat $(enabled_cairo_headers) || echo 'cairo_ERROR ()' ) | \
-	grep -v -E '^# *include' | \
+	$(EGREP) -v '^# *include' | \
 	( cat cairo-features.h - | $(CPP) -D__cplusplus - || echo 'cairo_ERROR ()' ) | \
-	grep -E '^cairo_.* \(' | \
+	$(EGREP) '^cairo_.* \(' | \
 	sed -e 's/[ 	].*//' | \
 	sort; \
 	echo LIBRARY libcairo-$(CAIRO_VERSION_SONUM).dll; \
commit a276ae6ab2ecea6f9d75e59da4d0a32c08d89420
Author: Benjamin Otte <otte at redhat.com>
Date:   Sat Jun 4 13:47:15 2011 +0200

    image: Don't crash on weird pixman formats
    
    _pixel_to_solid() used to assert that it got a known cairo_format_t.
    However, this might not be the case when backends decide to use a pixman
    format that is not representable by a cairo format (X and DirectFB are
    examples for backends that do that).
    
    This patch makes _pixel_to_solid() return NULL in that case and fixes
    the callers to deal with it.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=37916

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 7c56f16..ceffbc4 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -1316,10 +1316,12 @@ _pixel_to_solid (cairo_image_surface_t *image, int x, int y)
 
     switch (image->format) {
     default:
-    case CAIRO_FORMAT_INVALID:
 	ASSERT_NOT_REACHED;
 	return NULL;
 
+    case CAIRO_FORMAT_INVALID:
+	return NULL;
+
     case CAIRO_FORMAT_A1:
 	pixel = *(uint8_t *) (image->data + y * image->stride + x/8);
 	return pixel & (1 << (x&7)) ? _pixman_white_image () : _pixman_transparent_image ();
@@ -1415,7 +1417,9 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 		}
 		else
 		{
-		    return _pixel_to_solid (source, sample.x, sample.y);
+		    pixman_image = _pixel_to_solid (source, sample.x, sample.y);
+                    if (pixman_image)
+                        return pixman_image;
 		}
 	    }
 
@@ -1453,9 +1457,11 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 
 	    if (sample.width == 1 && sample.height == 1) {
 		if (is_contained) {
-		    return _pixel_to_solid (source,
-					    sub->extents.x + sample.x,
-					    sub->extents.y + sample.y);
+		    pixman_image = _pixel_to_solid (source,
+                                                    sub->extents.x + sample.x,
+                                                    sub->extents.y + sample.y);
+                    if (pixman_image)
+                        return pixman_image;
 		} else {
 		    if (extend == CAIRO_EXTEND_NONE)
 			return _pixman_transparent_image ();
@@ -1509,8 +1515,11 @@ _pixman_image_for_surface (const cairo_surface_pattern_t *pattern,
 	    else
 	    {
 		pixman_image = _pixel_to_solid (image, sample.x, sample.y);
-		_cairo_surface_release_source_image (pattern->surface, image, extra);
-		return pixman_image;
+                if (pixman_image)
+                {
+                    _cairo_surface_release_source_image (pattern->surface, image, extra);
+                    return pixman_image;
+                }
 	    }
 	}
 


More information about the cairo-commit mailing list