[cairo-commit] 4 commits - src/cairo-image-surface.c src/cairo-surface-fallback.c src/cairo-xlib-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Mar 2 09:17:25 PST 2010


 src/cairo-image-surface.c    |   32 ++++++++++++++++++++------------
 src/cairo-surface-fallback.c |   18 +++++-------------
 src/cairo-xlib-surface.c     |    4 +++-
 3 files changed, 28 insertions(+), 26 deletions(-)

New commits:
commit 4126d580d8b9db9217ed17aadcce20b14e77a00b
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 2 14:38:36 2010 +0000

    surface-fallback: Free traps on composite_trapezoids() error

diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 12c606d..7a69322 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -1574,12 +1574,13 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t		op,
 						  width, height,
 						  traps, num_traps,
 						  clip_region);
+ FAIL:
     if (offset_traps != NULL)
 	free (offset_traps);
 
- FAIL:
     if (fallback_region != NULL)
 	cairo_region_destroy (fallback_region);
+
     _fallback_fini (&state);
 
     return status;
commit 8a59522bbdc61d5c90f1ae55111b5408865755b3
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 2 14:36:16 2010 +0000

    surface-fallback: Propagate NOTHING_TO_DO
    
    NOTHING_TO_DO is converted to SUCCESS by the surface layer, so clean up
    the code slightly by reducing the number of checks and conversions.

diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index ae39b2b..12c606d 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -1404,11 +1404,8 @@ _cairo_surface_fallback_composite (cairo_operator_t		 op,
     cairo_status_t status;
 
     status = _fallback_init (&state, dst, dst_x, dst_y, width, height);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    status = CAIRO_STATUS_SUCCESS;
+    if (unlikely (status))
 	return status;
-    }
 
     /* We know this will never fail with the image backend; but
      * instead of calling into it directly, we call
@@ -1482,11 +1479,8 @@ _cairo_surface_fallback_fill_rectangles (cairo_surface_t         *surface,
     }
 
     status = _fallback_init (&state, surface, x1, y1, x2 - x1, y2 - y1);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    status = CAIRO_STATUS_SUCCESS;
+    if (unlikely (status))
 	return status;
-    }
 
     /* If the fetched image isn't at 0,0, we need to offset the rectangles */
 
@@ -1540,11 +1534,8 @@ _cairo_surface_fallback_composite_trapezoids (cairo_operator_t		op,
     cairo_status_t status;
 
     status = _fallback_init (&state, dst, dst_x, dst_y, width, height);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    status = CAIRO_STATUS_SUCCESS;
+    if (unlikely (status))
 	return status;
-    }
 
     /* If the destination image isn't at 0,0, we need to offset the trapezoids */
 
commit f07195860620959c27d43080a7b987e28222735a
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 2 13:57:02 2010 +0000

    xlib: Handle a1 image uploads through converter
    
    Fixes test/large-source [xlib]

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index f8620e3..ad7d625 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -1154,7 +1154,9 @@ _draw_image_surface (cairo_xlib_surface_t   *surface,
 		int dither_adjustment = dither_row[x_off];
 		int a, r, g, b;
 
-		if (image_masks.bpp <= 8)
+		if (image_masks.bpp == 1)
+		    in_pixel = !! (((uint8_t*)row)[x/8] & (1 << (x & 7)));
+		else if (image_masks.bpp <= 8)
 		    in_pixel = ((uint8_t*)row)[x];
 		else if (image_masks.bpp <= 16)
 		    in_pixel = ((uint16_t*)row)[x];
commit f979dd22d8f48e6ac7c50372c7d180c3b590dc74
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Mar 2 11:20:11 2010 +0000

    image: Don't rely on clip regions being clipped to surface extents.
    
    Fixes a crash in test/clip-fill-unbounded [xlib-fallback].

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index e53f53f..5455613 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -3918,13 +3918,17 @@ _cairo_image_surface_composite (cairo_operator_t	 op,
     extents.bounded.width  = width;
     extents.bounded.height = height;
 
+    extents.unbounded.x = 0;
+    extents.unbounded.y = 0;
+    extents.unbounded.width  = dst->width;
+    extents.unbounded.height = dst->height;
+
     if (clip_region != NULL) {
-	cairo_region_get_extents (clip_region, &extents.unbounded);
-    } else {
-	extents.unbounded.x = 0;
-	extents.unbounded.y = 0;
-	extents.unbounded.width  = dst->width;
-	extents.unbounded.height = dst->height;
+	cairo_rectangle_int_t rect;
+
+	cairo_region_get_extents (clip_region, &rect);
+	if (! _cairo_rectangle_intersect (&extents.unbounded, &rect))
+	    return CAIRO_STATUS_SUCCESS;
     }
 
     extents.is_bounded = _cairo_operator_bounded_by_either (op);
@@ -4066,13 +4070,17 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t	op,
     extents.bounded.width  = width;
     extents.bounded.height = height;
 
+    extents.unbounded.x = 0;
+    extents.unbounded.y = 0;
+    extents.unbounded.width  = dst->width;
+    extents.unbounded.height = dst->height;
+
     if (clip_region != NULL) {
-	cairo_region_get_extents (clip_region, &extents.unbounded);
-    } else {
-	extents.unbounded.x = 0;
-	extents.unbounded.y = 0;
-	extents.unbounded.width  = dst->width;
-	extents.unbounded.height = dst->height;
+	cairo_rectangle_int_t rect;
+
+	cairo_region_get_extents (clip_region, &rect);
+	if (! _cairo_rectangle_intersect (&extents.unbounded, &rect))
+	    return CAIRO_STATUS_SUCCESS;
     }
 
     extents.is_bounded = _cairo_operator_bounded_by_either (op);


More information about the cairo-commit mailing list