[cairo-commit] 4 commits - src/cairo-clip-private.h src/cairo-gstate.c src/cairo-path-fill.c src/cairo-surface.c src/cairo-surface-fallback.c src/cairo-xlib-screen.c

Benjamin Otte company at kemper.freedesktop.org
Sun Oct 18 13:22:22 PDT 2009


 src/cairo-clip-private.h     |    9 ------
 src/cairo-gstate.c           |    4 ++
 src/cairo-path-fill.c        |    7 ++---
 src/cairo-surface-fallback.c |   41 ++++-------------------------
 src/cairo-surface.c          |   59 -------------------------------------------
 src/cairo-xlib-screen.c      |    8 ++---
 6 files changed, 17 insertions(+), 111 deletions(-)

New commits:
commit a2254e56474fcdf5f25232812cdbef30a2b5ea60
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Oct 18 22:12:13 2009 +0200

    [gstate] Apply target device offsets to patterns immediately
    
    Previously target device offsets were applied in cairo-surface.c which
    could cause bugs when paths were taken as fallbacks, as for example
    pointed out by ade55037ffa596b690c6a1051394589f76eb1f48 and quick-fixed
    by 79190d89853958ee8252440d35a662fabf122afd. The quick-fix is now
    unnecessary and was removed.

diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index ed0e877..7ee88d6 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -897,6 +897,10 @@ _cairo_gstate_copy_transformed_pattern (cairo_gstate_t  *gstate,
 
     if (! _cairo_matrix_is_identity (ctm_inverse))
 	_cairo_pattern_transform (pattern, ctm_inverse);
+
+    if (_cairo_surface_has_device_transform (gstate->target))
+        _cairo_pattern_transform (pattern,
+                                  &gstate->target->device_transform_inverse);
 }
 
 static void
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 15d2a63..c5ef274 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -984,35 +984,6 @@ _clip_to_boxes (cairo_clip_t **clip,
     return status;
 }
 
-/* XXX _cairo_surface_backend_fill? */
-static cairo_status_t
-_wrap_surface_fill (cairo_surface_t	*surface,
-		    cairo_operator_t	 op,
-		    const cairo_pattern_t *source,
-		    cairo_path_fixed_t	*path,
-		    cairo_fill_rule_t	 fill_rule,
-		    double		 tolerance,
-		    cairo_antialias_t	 antialias,
-		    cairo_clip_t	*clip)
-{
-    if (surface->backend->fill != NULL) {
-	cairo_status_t status;
-
-	status = surface->backend->fill (surface, op, source,
-					 path, fill_rule,
-					 tolerance, antialias,
-					 clip);
-
-	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
-	    return status;
-    }
-
-    return _cairo_surface_fallback_fill (surface, op, source,
-					 path, fill_rule,
-					 tolerance, antialias,
-					 clip);
-}
-
 cairo_status_t
 _cairo_surface_fallback_paint (cairo_surface_t		*surface,
 			       cairo_operator_t		 op,
@@ -1066,12 +1037,12 @@ _cairo_surface_fallback_paint (cairo_surface_t		*surface,
     if (clip != NULL && clip_path->prev == NULL &&
 	_cairo_operator_bounded_by_mask (op))
     {
-	return _wrap_surface_fill (surface, op, source,
-				   &clip_path->path,
-				   clip_path->fill_rule,
-				   clip_path->tolerance,
-				   clip_path->antialias,
-				   NULL);
+	return _cairo_surface_fill (surface, op, source,
+				    &clip_path->path,
+				    clip_path->fill_rule,
+				    clip_path->tolerance,
+				    clip_path->antialias,
+				    NULL);
     }
 
     status = _cairo_traps_init_boxes (&traps, boxes, num_boxes);
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 51eb6f0..e080c31 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -91,11 +91,6 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_WRITE_ERROR, _cairo_surface_nil_write_err
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_STRIDE, _cairo_surface_nil_invalid_stride);
 static DEFINE_NIL_SURFACE(CAIRO_STATUS_INVALID_SIZE, _cairo_surface_nil_invalid_size);
 
-static void
-_cairo_surface_copy_pattern_for_destination (const cairo_pattern_t **pattern,
-					     cairo_surface_t *destination,
-					     cairo_pattern_t *pattern_copy);
-
 /**
  * _cairo_surface_set_error:
  * @surface: a surface
@@ -1922,7 +1917,6 @@ _cairo_surface_paint (cairo_surface_t	*surface,
 		      cairo_clip_t	    *clip)
 {
     cairo_status_t status;
-    cairo_pattern_union_t dev_source;
 
     if (unlikely (surface->status))
 	return surface->status;
@@ -1932,10 +1926,6 @@ _cairo_surface_paint (cairo_surface_t	*surface,
 
     _cairo_surface_begin_modification (surface);
 
-    _cairo_surface_copy_pattern_for_destination (&source,
-						 surface,
-						 &dev_source.base);
-
     if (surface->backend->paint != NULL) {
 	status = surface->backend->paint (surface, op, source, clip);
 	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
@@ -1956,8 +1946,6 @@ _cairo_surface_mask (cairo_surface_t		*surface,
 		     cairo_clip_t		*clip)
 {
     cairo_status_t status;
-    cairo_pattern_union_t dev_source;
-    cairo_pattern_union_t dev_mask;
 
     if (unlikely (surface->status))
 	return surface->status;
@@ -1967,11 +1955,6 @@ _cairo_surface_mask (cairo_surface_t		*surface,
 
     _cairo_surface_begin_modification (surface);
 
-    _cairo_surface_copy_pattern_for_destination (&source, surface,
-						 &dev_source.base);
-    _cairo_surface_copy_pattern_for_destination (&mask, surface,
-						 &dev_mask.base);
-
     if (surface->backend->mask != NULL) {
 	status = surface->backend->mask (surface, op, source, mask, clip);
 	if (status != CAIRO_INT_STATUS_UNSUPPORTED)
@@ -2012,16 +1995,9 @@ _cairo_surface_fill_stroke (cairo_surface_t	    *surface,
     _cairo_surface_begin_modification (surface);
 
     if (surface->backend->fill_stroke) {
-	cairo_pattern_union_t dev_stroke_source;
-	cairo_pattern_union_t dev_fill_source;
 	cairo_matrix_t dev_ctm = *stroke_ctm;
 	cairo_matrix_t dev_ctm_inverse = *stroke_ctm_inverse;
 
-	_cairo_surface_copy_pattern_for_destination (&stroke_source, surface,
-						     &dev_stroke_source.base);
-	_cairo_surface_copy_pattern_for_destination (&fill_source, surface,
-						     &dev_fill_source.base);
-
 	status = surface->backend->fill_stroke (surface,
 						fill_op, fill_source, fill_rule,
 						fill_tolerance, fill_antialias,
@@ -2065,7 +2041,6 @@ _cairo_surface_stroke (cairo_surface_t		*surface,
 		       cairo_clip_t		*clip)
 {
     cairo_status_t status;
-    cairo_pattern_union_t dev_source;
 
     if (unlikely (surface->status))
 	return surface->status;
@@ -2075,9 +2050,6 @@ _cairo_surface_stroke (cairo_surface_t		*surface,
 
     _cairo_surface_begin_modification (surface);
 
-    _cairo_surface_copy_pattern_for_destination (&source, surface,
-						 &dev_source.base);
-
     if (surface->backend->stroke != NULL) {
 	status = surface->backend->stroke (surface, op, source,
 					   path, stroke_style,
@@ -2110,7 +2082,6 @@ _cairo_surface_fill (cairo_surface_t	*surface,
 		     cairo_clip_t	*clip)
 {
     cairo_status_t status;
-    cairo_pattern_union_t dev_source;
 
     if (unlikely (surface->status))
 	return surface->status;
@@ -2120,8 +2091,6 @@ _cairo_surface_fill (cairo_surface_t	*surface,
 
     _cairo_surface_begin_modification (surface);
 
-    _cairo_surface_copy_pattern_for_destination (&source, surface,
-						 &dev_source.base);
     if (surface->backend->fill != NULL) {
 	status = surface->backend->fill (surface, op, source,
 					 path, fill_rule,
@@ -2429,7 +2398,6 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 {
     cairo_status_t status;
     cairo_scaled_font_t *dev_scaled_font = scaled_font;
-    cairo_pattern_union_t dev_source;
 
     if (unlikely (surface->status))
 	return surface->status;
@@ -2442,9 +2410,6 @@ _cairo_surface_show_text_glyphs (cairo_surface_t	    *surface,
 
     _cairo_surface_begin_modification (surface);
 
-    _cairo_surface_copy_pattern_for_destination (&source, surface,
-						 &dev_source.base);
-
     if (_cairo_surface_has_device_transform (surface) &&
 	! _cairo_matrix_is_integer_translation (&surface->device_transform, NULL, NULL))
     {
@@ -2794,30 +2759,6 @@ _cairo_surface_composite_shape_fixup_unbounded (cairo_surface_t            *dst,
 }
 
 /**
- * _cairo_surface_copy_pattern_for_destination
- * @pattern: the pattern to copy
- * @destination: the destination surface for which the pattern is being copied
- * @pattern_copy: the location to hold the copy
- *
- * Copies the given pattern, taking into account device scale and offsets
- * of the destination surface.
- */
-static void
-_cairo_surface_copy_pattern_for_destination (const cairo_pattern_t **pattern,
-                                             cairo_surface_t *destination,
-                                             cairo_pattern_t *pattern_copy)
-{
-    if (! _cairo_surface_has_device_transform (destination))
-	return;
-
-    _cairo_pattern_init_static_copy (pattern_copy, *pattern);
-    _cairo_pattern_transform (pattern_copy,
-			      &destination->device_transform_inverse);
-
-    *pattern = pattern_copy;
-}
-
-/**
  * _cairo_surface_set_resolution
  * @surface: the surface
  * @x_res: x resolution, in dpi
commit 4b720d56db72d314b3b7cedb05a53321b1d0adbe
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Oct 18 21:32:10 2009 +0200

    [clip] Remove non-existing functions from header

diff --git a/src/cairo-clip-private.h b/src/cairo-clip-private.h
index 15b4a4b..6128243 100644
--- a/src/cairo-clip-private.h
+++ b/src/cairo-clip-private.h
@@ -129,15 +129,6 @@ _cairo_clip_get_boxes (cairo_clip_t *clip,
 		       int *count);
 
 cairo_private void
-_cairo_clip_translate (cairo_clip_t  *clip,
-                       cairo_fixed_t  tx,
-                       cairo_fixed_t  ty);
-
-cairo_private void
-_cairo_clip_transform (cairo_clip_t  *clip,
-		       const cairo_matrix_t *transform);
-
-cairo_private void
 _cairo_clip_drop_cache (cairo_clip_t  *clip);
 
 cairo_private cairo_rectangle_list_t*
commit cacf9ccedffa0c804a56c76c8ab17bf81831b621
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Oct 18 21:30:22 2009 +0200

    [path] Fix compiler warnings

diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index c2deadc..037b807 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -64,8 +64,8 @@ _cairo_filler_move_to (void *closure,
     cairo_filler_t *filler = closure;
     cairo_polygon_t *polygon = filler->polygon;
 
-    _cairo_polygon_close (polygon);
-    return _cairo_polygon_move_to (polygon, point);
+    return _cairo_polygon_close (polygon) ||
+           _cairo_polygon_move_to (polygon, point);
 }
 
 static cairo_status_t
@@ -122,8 +122,7 @@ _cairo_path_fixed_fill_to_polygon (const cairo_path_fixed_t *path,
     if (unlikely (status))
 	return status;
 
-    _cairo_polygon_close (polygon);
-    status = _cairo_polygon_status (polygon);
+    status = _cairo_polygon_close (polygon);
     _cairo_filler_fini (&filler);
 
     return status;
commit a70705b2ede8c0dc401f28405641e70f8a6d8d92
Author: Benjamin Otte <otte at gnome.org>
Date:   Sun Oct 18 21:30:06 2009 +0200

    [xlib] Fix compiler warnings

diff --git a/src/cairo-xlib-screen.c b/src/cairo-xlib-screen.c
index fc2535b..8e29475 100644
--- a/src/cairo-xlib-screen.c
+++ b/src/cairo-xlib-screen.c
@@ -395,13 +395,13 @@ _cairo_xlib_screen_get_gc (cairo_xlib_screen_t *info,
 	if (old == 0)
 	    break;
 
-	if (((old >> 0) & 0xff) == (unsigned) depth)
+	if (((old >> 0) & 0xff) == depth)
 	    i = 0;
-	else if (((old >> 8) & 0xff) == (unsigned) depth)
+	else if (((old >> 8) & 0xff) == depth)
 	    i = 1;
-	else if (((old >> 16) & 0xff) == (unsigned) depth)
+	else if (((old >> 16) & 0xff) == depth)
 	    i = 2;
-	else if (((old >> 24) & 0xff) == (unsigned) depth)
+	else if (((old >> 24) & 0xff) == depth)
 	    i = 3;
 	else
 	    break;


More information about the cairo-commit mailing list