[cairo-commit] 3 commits - src/cairo-quartz-surface.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Tue Oct 12 11:41:41 PDT 2010


 src/cairo-quartz-surface.c |   77 ---------------------------------------------
 1 file changed, 77 deletions(-)

New commits:
commit 1c36766d27173c5e4751e131d6bf26441d95a10e
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Oct 12 16:06:45 2010 +0200

    quartz: Remove unused code
    
    The gradient fallback path is not used anymore.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 251862f..d8ae886 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1329,59 +1329,6 @@ typedef enum {
     DO_TILED_IMAGE
 } cairo_quartz_action_t;
 
-static cairo_quartz_action_t
-_cairo_quartz_setup_fallback_source (cairo_quartz_surface_t *surface,
-				     const cairo_pattern_t *source)
-{
-    cairo_pattern_union_t pattern;
-    CGRect clipBox = CGContextGetClipBoundingBox (surface->cgContext);
-    double x0, y0, w, h;
-
-    cairo_surface_t *fallback;
-    CGImageRef img;
-
-    cairo_status_t status;
-
-    if (clipBox.size.width == 0.0f ||
-	clipBox.size.height == 0.0f)
-	return DO_NOTHING;
-
-    x0 = floor (clipBox.origin.x);
-    y0 = floor (clipBox.origin.y);
-    w = ceil (clipBox.origin.x + clipBox.size.width) - x0;
-    h = ceil (clipBox.origin.y + clipBox.size.height) - y0;
-
-    /* Create a temporary the size of the clip surface, and position
-     * it so that the device origin coincides with the original surface */
-    fallback = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, (int) w, (int) h);
-    cairo_surface_set_device_offset (fallback, -x0, -y0);
-
-    _cairo_pattern_init_static_copy (&pattern.base, source);
-    _cairo_pattern_transform (&pattern.base, &fallback->device_transform_inverse);
-    status = _cairo_surface_paint (fallback, CAIRO_OPERATOR_SOURCE, &pattern.base, NULL);
-    if (unlikely (status)) {
-	cairo_surface_destroy (fallback);
-	return DO_UNSUPPORTED;
-    }
-
-    status = _cairo_surface_to_cgimage (fallback, &img);
-    if (unlikely (status)) {
-	cairo_surface_destroy (fallback);
-	return DO_UNSUPPORTED;
-    }
-    if (unlikely (img == NULL)) {
-	cairo_surface_destroy (fallback);
-	return DO_NOTHING;
-    }
-
-    surface->sourceImageRect = CGRectMake (0.0, 0.0, w, h);
-    surface->sourceImage = img;
-    surface->sourceImageSurface = fallback;
-    surface->sourceTransform = CGAffineTransformMakeTranslation (x0, y0);
-
-    return DO_IMAGE;
-}
-
 /*
 Quartz does not support repeating radients. We handle repeating gradients
 by manually extending the gradient and repeating color stops. We need to
commit 2cea2bb085a34650defbc18a477ddf468060b58c
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Oct 12 15:37:23 2010 +0200

    quartz: Make radial gradients follow PDF specification
    
    Pixman master (soon to become pixman 0.20) implements radial
    gradients based on the PDF specification (section 8.7.4.5.4).
    Quartz natively implements them, so falling back is not needed
    anymore.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 422a853..251862f 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1459,23 +1459,9 @@ _cairo_quartz_setup_radial_source (cairo_quartz_surface_t *surface,
     double c2y = _cairo_fixed_to_double (rpat->c2.y);
     double r1 = _cairo_fixed_to_double (rpat->r1);
     double r2 = _cairo_fixed_to_double (rpat->r2);
-    double dx = c1x - c2x;
-    double dy = c1y - c2y;
-    double centerDistance = sqrt (dx*dx + dy*dy);
 
     assert (rpat->base.n_stops > 0);
 
-    if (r2 <= centerDistance + r1 + 1e-6 && /* circle 2 doesn't contain circle 1 */
-        r1 <= centerDistance + r2 + 1e-6) { /* circle 1 doesn't contain circle 2 */
-	/* Quartz handles cases where neither circle contains the other very
-	 * differently from pixman.
-	 * Whatever the correct behaviour is, let's at least have only pixman's
-	 * implementation to worry about.
-	 * Note that this also catches the cases where r1 == r2.
-	 */
-	return _cairo_quartz_setup_fallback_source (surface, abspat);
-    }
-
     mat = abspat->matrix;
     cairo_matrix_invert (&mat);
     _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);
commit 5054727927ee86c5952f8956aa0225f49e9ff66e
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Oct 12 16:04:53 2010 +0200

    quartz: Remove linear gradient fallback
    
    Degenerate linear gradients are reduced to solid gradients in
    gstate, so backends do not need to handle them.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 1d7ef04..422a853 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1409,16 +1409,6 @@ _cairo_quartz_setup_linear_source (cairo_quartz_surface_t *surface,
 
     assert (lpat->base.n_stops > 0);
 
-    if (lpat->p1.x == lpat->p2.x &&
-        lpat->p1.y == lpat->p2.y) {
-	/* Quartz handles cases where the vector has no length very
-	 * differently from pixman.
-	 * Whatever the correct behaviour is, let's at least have only pixman's
-	 * implementation to worry about.
-	 */
-	return _cairo_quartz_setup_fallback_source (surface, abspat);
-    }
-
     mat = abspat->matrix;
     cairo_matrix_invert (&mat);
     _cairo_quartz_cairo_matrix_to_quartz (&mat, &surface->sourceTransform);


More information about the cairo-commit mailing list