[cairo-commit] 4 commits - src/cairo-glitz-surface.c src/cairo-image-surface.c src/cairoint.h src/cairo-pattern.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-quartz-surface.c src/cairo-svg-surface.c src/cairo-win32-printing-surface.c test/clip-operator-pdf-argb32-ref.png test/clip-operator-ps-argb32-ref.png test/clip-operator-ref.png test/ft-show-glyphs-positioning-svg-ref.png test/operator-clear-ps-argb32-ref.png test/operator-source-ref.png

Carl Worth cworth at kemper.freedesktop.org
Wed Mar 26 14:52:21 PDT 2008


 src/cairo-glitz-surface.c                   |    2 -
 src/cairo-image-surface.c                   |    1 
 src/cairo-pattern.c                         |   10 +++------
 src/cairo-pdf-surface.c                     |    6 ++---
 src/cairo-ps-surface.c                      |    6 ++---
 src/cairo-quartz-surface.c                  |    6 ++---
 src/cairo-svg-surface.c                     |   31 ++++++++++++----------------
 src/cairo-win32-printing-surface.c          |    2 -
 src/cairoint.h                              |    2 -
 test/clip-operator-pdf-argb32-ref.png       |binary
 test/clip-operator-ps-argb32-ref.png        |binary
 test/clip-operator-ref.png                  |binary
 test/ft-show-glyphs-positioning-svg-ref.png |binary
 test/operator-clear-ps-argb32-ref.png       |binary
 test/operator-source-ref.png                |binary
 15 files changed, 30 insertions(+), 36 deletions(-)

New commits:
commit af8928fa8bb8905515f36b4ddc51e665b4b8da56
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Mar 26 14:21:58 2008 -0700

    Add svg-specific reference image for ft-show-glyphs-positioning test
    
    There was no failure here, just minor rasterization differences.

diff --git a/test/ft-show-glyphs-positioning-svg-ref.png b/test/ft-show-glyphs-positioning-svg-ref.png
new file mode 100644
index 0000000..43b83cb
Binary files /dev/null and b/test/ft-show-glyphs-positioning-svg-ref.png differ
commit fbab4bbb06d875313e9cd0dc38673b79b8460edb
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Mar 26 13:47:06 2008 -0700

    Update clip-operator and operator-clear reference images
    
    There were legitimate bugs in the ps and pdf backends for these
    tests, (particularly with the row of glyphs), but these bugs
    were recently fixed with:
    
    commit d89edde84de9cec9ce6f76f4f2c44dd9c1220528
    Author: Vladimir Vukicevic <vladimir at pobox.com>
    Date:   Tue Mar 4 00:15:46 2008 -0800
    
        [meta] always copy glyph array before passing to _cairo_surface_show_glyphs
    
    and we just failed to notice the fix at the time.

diff --git a/test/clip-operator-pdf-argb32-ref.png b/test/clip-operator-pdf-argb32-ref.png
index 6e7a772..6513e0e 100644
Binary files a/test/clip-operator-pdf-argb32-ref.png and b/test/clip-operator-pdf-argb32-ref.png differ
diff --git a/test/clip-operator-ps-argb32-ref.png b/test/clip-operator-ps-argb32-ref.png
index 9348e3b..35014bd 100644
Binary files a/test/clip-operator-ps-argb32-ref.png and b/test/clip-operator-ps-argb32-ref.png differ
diff --git a/test/operator-clear-ps-argb32-ref.png b/test/operator-clear-ps-argb32-ref.png
index f0333a0..d9a7769 100644
Binary files a/test/operator-clear-ps-argb32-ref.png and b/test/operator-clear-ps-argb32-ref.png differ
commit 75972167a277687b1434c52e791ffe9c18fa2a7a
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Mar 26 11:31:04 2008 -0700

    Use floating-point offsets for color stops
    
    Previously we were using the cairo_fixed_t type which meant we've
    historically only been using 16 bits of precision for these offsets,
    and recently only 8 bits. Meanwhile, all manipulatons of offsets
    have been in floating-point anyway, so we might as well store them
    that way.
    
    This change also prevents a rendering regression introduced with the
    24.8->16.16 change betwen snapshots 1.5.10 and 1.5.12 .
    
    This change affected gradient-rendering details for the clip-operator
    and operator-source tests, so the corresponding reference images are
    updated here.

diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c
index 5144895..592dd13 100644
--- a/src/cairo-glitz-surface.c
+++ b/src/cairo-glitz-surface.c
@@ -817,7 +817,7 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t	              *pattern,
 		(((int) (gradient->stops[i].color.green_short >> 8)) << 8)  |
 		(((int) (gradient->stops[i].color.blue_short  >> 8)));
 
-	    params[n_base_params + 3 * i + 0] = gradient->stops[i].x;
+	    params[n_base_params + 3 * i + 0] = _cairo_fixed_16_16_from_double (gradient->stops[i].offset);
 	    params[n_base_params + 3 * i + 1] = i << 16;
 	    params[n_base_params + 3 * i + 2] = 0;
 	}
diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c
index 8ec3987..bd67163 100644
--- a/src/cairo-pattern.c
+++ b/src/cairo-pattern.c
@@ -821,7 +821,6 @@ _cairo_pattern_add_color_stop (cairo_gradient_pattern_t *pattern,
 			       double			 alpha)
 {
     cairo_gradient_stop_t *stops;
-    cairo_fixed_t	   x;
     unsigned int	   i;
 
     if (pattern->n_stops >= pattern->stops_size) {
@@ -834,10 +833,9 @@ _cairo_pattern_add_color_stop (cairo_gradient_pattern_t *pattern,
 
     stops = pattern->stops;
 
-    x = _cairo_fixed_from_double (offset);
     for (i = 0; i < pattern->n_stops; i++)
     {
-	if (x < stops[i].x)
+	if (offset < stops[i].offset)
 	{
 	    memmove (&stops[i + 1], &stops[i],
 		     sizeof (cairo_gradient_stop_t) * (pattern->n_stops - i));
@@ -846,7 +844,7 @@ _cairo_pattern_add_color_stop (cairo_gradient_pattern_t *pattern,
 	}
     }
 
-    stops[i].x = x;
+    stops[i].offset = offset;
 
     stops[i].color.red   = red;
     stops[i].color.green = green;
@@ -1208,7 +1206,7 @@ _cairo_pattern_acquire_surface_for_gradient (cairo_gradient_pattern_t *pattern,
     }
 
     for (i = 0; i < pattern->n_stops; i++) {
-	pixman_stops[i].x = _cairo_fixed_to_16_16 (pattern->stops[i].x);
+	pixman_stops[i].x = _cairo_fixed_16_16_from_double (pattern->stops[i].offset);
 	pixman_stops[i].color.red = pattern->stops[i].color.red_short;
 	pixman_stops[i].color.green = pattern->stops[i].color.green_short;
 	pixman_stops[i].color.blue = pattern->stops[i].color.blue_short;
@@ -2155,7 +2153,7 @@ cairo_pattern_get_color_stop_rgba (cairo_pattern_t *pattern,
 	return _cairo_error (CAIRO_STATUS_INVALID_INDEX);
 
     if (offset)
-	*offset = _cairo_fixed_to_double(gradient->stops[index].x);
+	*offset = gradient->stops[index].offset;
     if (red)
 	*red = gradient->stops[index].color.red;
     if (green)
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index cce4b3c..7dad2f5 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -1981,7 +1981,7 @@ _cairo_pdf_surface_emit_pattern_stops (cairo_pdf_surface_t      *surface,
 	stops[i].color[3] = pattern->stops[i].color.alpha;
         if (!CAIRO_ALPHA_IS_OPAQUE (stops[i].color[3]))
             emit_alpha = TRUE;
-	stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
+	stops[i].offset = pattern->stops[i].offset;
     }
 
     if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
@@ -2220,8 +2220,8 @@ _cairo_pdf_surface_emit_linear_pattern (cairo_pdf_surface_t    *surface,
     assert (status == CAIRO_STATUS_SUCCESS);
 
     cairo_matrix_multiply (&pat_to_pdf, &pat_to_pdf, &surface->cairo_to_pdf);
-    first_stop = _cairo_fixed_to_double (gradient->stops[0].x);
-    last_stop = _cairo_fixed_to_double (gradient->stops[gradient->n_stops - 1].x);
+    first_stop = gradient->stops[0].offset;
+    last_stop = gradient->stops[gradient->n_stops - 1].offset;
 
     if (pattern->base.base.extend == CAIRO_EXTEND_REPEAT ||
 	pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index bfe8b19..b771048 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -2467,7 +2467,7 @@ _cairo_ps_surface_emit_pattern_stops (cairo_ps_surface_t       *surface,
 	stops[i].color[1] = stop->color.green;
 	stops[i].color[2] = stop->color.blue;
 	stops[i].color[3] = stop->color.alpha;
-	stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
+	stops[i].offset = pattern->stops[i].offset;
     }
 
     if (pattern->base.extend == CAIRO_EXTEND_REPEAT ||
@@ -2586,8 +2586,8 @@ _cairo_ps_surface_emit_linear_pattern (cairo_ps_surface_t     *surface,
     assert (status == CAIRO_STATUS_SUCCESS);
 
     cairo_matrix_multiply (&pat_to_ps, &pat_to_ps, &surface->cairo_to_ps);
-    first_stop = _cairo_fixed_to_double (gradient->stops[0].x);
-    last_stop = _cairo_fixed_to_double (gradient->stops[gradient->n_stops - 1].x);
+    first_stop = gradient->stops[0].offset;
+    last_stop = gradient->stops[gradient->n_stops - 1].offset;
 
     if (pattern->base.base.extend == CAIRO_EXTEND_REPEAT ||
 	pattern->base.base.extend == CAIRO_EXTEND_REFLECT) {
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 4c2e9b5..5296eb5 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -556,7 +556,7 @@ ComputeGradientValue (void *info, const float *in, float *out)
     }
 
     for (i = 0; i < grad->n_stops; i++) {
-	if (_cairo_fixed_to_double (grad->stops[i].x) > fdist)
+	if (grad->stops[i].offset > fdist)
 	    break;
     }
 
@@ -568,8 +568,8 @@ ComputeGradientValue (void *info, const float *in, float *out)
 	out[2] = grad->stops[i].color.blue;
 	out[3] = grad->stops[i].color.alpha;
     } else {
-	float ax = _cairo_fixed_to_double(grad->stops[i-1].x);
-	float bx = _cairo_fixed_to_double(grad->stops[i].x) - ax;
+	float ax = grad->stops[i-1].offset;
+	float bx = grad->stops[i].offset - ax;
 	float bp = (fdist - ax)/bx;
 	float ap = 1.0 - bp;
 
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index a610b12..1b7b3e8 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -1294,7 +1294,7 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 					 "<stop offset=\"%f\" style=\""
 					 "stop-color: rgb(%f%%,%f%%,%f%%); "
 					 "stop-opacity: %f;\"/>\n",
-					 _cairo_fixed_to_double (pattern->stops[0].x),
+					 pattern->stops[0].offset,
 					 pattern->stops[0].color.red   * 100.0,
 					 pattern->stops[0].color.green * 100.0,
 					 pattern->stops[0].color.blue  * 100.0,
@@ -1311,22 +1311,20 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 	for (i = 0; i < pattern->n_stops; i++) {
 	    if (reverse_stops) {
 		stops[i] = pattern->stops[pattern->n_stops - i - 1];
-		stops[i].x = _cairo_fixed_from_double (1.0 - _cairo_fixed_to_double (stops[i].x));
+		stops[i].offset = 1.0 - stops[i].offset;
 	    } else
 		stops[i] = pattern->stops[i];
 	    if (emulate_reflect) {
-		stops[i].x /= 2;
+		stops[i].offset /= 2;
 		if (i > 0 && i < (pattern->n_stops - 1)) {
 		    if (reverse_stops) {
 			stops[i + pattern->n_stops - 1] = pattern->stops[i];
-			stops[i + pattern->n_stops - 1].x =
-			    _cairo_fixed_from_double (0.5 + 0.5
-				* _cairo_fixed_to_double (stops[i + pattern->n_stops - 1].x));
+			stops[i + pattern->n_stops - 1].offset =
+			    0.5 + 0.5 * stops[i + pattern->n_stops - 1].offset;
 		    } else {
 			stops[i + pattern->n_stops - 1] = pattern->stops[pattern->n_stops - i - 1];
-			stops[i + pattern->n_stops - 1].x =
-			    _cairo_fixed_from_double (1 - 0.5
-				* _cairo_fixed_to_double (stops [i + pattern->n_stops - 1].x));
+			stops[i + pattern->n_stops - 1].offset =
+			    1 - 0.5 * stops[i + pattern->n_stops - 1].offset;
 		    }
 		}
 	    }
@@ -1338,8 +1336,7 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 
     if (start_offset >= 0.0)
 	for (i = 0; i < n_stops; i++) {
-	    offset = start_offset + (1 - start_offset ) *
-		_cairo_fixed_to_double (stops[i].x);
+	    offset = start_offset + (1 - start_offset ) * stops[i].offset;
 	    _cairo_output_stream_printf (output,
 					 "<stop offset=\"%f\" style=\""
 					 "stop-color: rgb(%f%%,%f%%,%f%%); "
@@ -1356,14 +1353,14 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 	cairo_color_t offset_color_start, offset_color_stop;
 
 	for (i = 0; i < n_stops; i++) {
-	    if (_cairo_fixed_to_double (stops[i].x) >= -start_offset) {
+	    if (stops[i].offset >= -start_offset) {
 		if (i > 0) {
-		    if (stops[i].x != stops[i-1].x) {
+		    if (stops[i].offset != stops[i-1].offset) {
 			double x0, x1;
 			cairo_color_t *color0, *color1;
 
-			x0 = _cairo_fixed_to_double (stops[i-1].x);
-			x1 = _cairo_fixed_to_double (stops[i].x);
+			x0 = stops[i-1].offset;
+			x1 = stops[i].offset;
 			color0 = &stops[i-1].color;
 			color1 = &stops[i].color;
 			offset_color_start.red = color0->red + (color1->red - color0->red)
@@ -1405,7 +1402,7 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 					 "<stop offset=\"%f\" style=\""
 					 "stop-color: rgb(%f%%,%f%%,%f%%); "
 					 "stop-opacity: %f;\"/>\n",
-					 _cairo_fixed_to_double (stops[i].x) + start_offset,
+					 stops[i].offset + start_offset,
 					 stops[i].color.red   * 100.0,
 					 stops[i].color.green * 100.0,
 					 stops[i].color.blue  * 100.0,
@@ -1416,7 +1413,7 @@ _cairo_svg_surface_emit_pattern_stops (cairo_output_stream_t          *output,
 					 "<stop offset=\"%f\" style=\""
 					 "stop-color: rgb(%f%%,%f%%,%f%%); "
 					 "stop-opacity: %f;\"/>\n",
-					 1.0 + _cairo_fixed_to_double (stops[i].x) + start_offset,
+					 1.0 + stops[i].offset + start_offset,
 					 stops[i].color.red   * 100.0,
 					 stops[i].color.green * 100.0,
 					 stops[i].color.blue  * 100.0,
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index d83b732..cc3a17b 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -757,7 +757,7 @@ _cairo_win32_printing_surface_paint_linear_pattern (cairo_win32_surface_t *surfa
 	}
 
 	stop = i%num_rects + 1;
-	vert[i*2+1].x = (LONG)(d*(range_start + i/num_rects + _cairo_fixed_to_double (pattern->base.stops[stop].x)));
+	vert[i*2+1].x = (LONG)(d*(range_start + i/num_rects + pattern->base.stops[stop].offset));
 	vert[i*2+1].y = (LONG) clip.bottom;
 	if (extend == CAIRO_EXTEND_REFLECT && (range_start+(i/num_rects))%2)
 	    stop = num_rects - stop;
diff --git a/src/cairoint.h b/src/cairoint.h
index ea47ed5..9fa4bde 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -790,7 +790,7 @@ typedef struct _cairo_surface_pattern {
 } cairo_surface_pattern_t;
 
 typedef struct _cairo_gradient_stop {
-    cairo_fixed_t x;
+    double offset;
     cairo_color_t color;
 } cairo_gradient_stop_t;
 
diff --git a/test/clip-operator-ref.png b/test/clip-operator-ref.png
index fe11362..4ea1842 100644
Binary files a/test/clip-operator-ref.png and b/test/clip-operator-ref.png differ
diff --git a/test/operator-source-ref.png b/test/operator-source-ref.png
index ccd9be3..8e2f5e6 100644
Binary files a/test/operator-source-ref.png and b/test/operator-source-ref.png differ
commit 80dc1714c87c3902e70fa94e4911945986cc7920
Author: Carl Worth <cworth at cworth.org>
Date:   Wed Mar 26 10:31:36 2008 -0700

    Remove unused variable

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index e8fc4d5..092b77e 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -150,7 +150,6 @@ _pixman_format_from_masks (cairo_format_masks_t *masks,
 {
     pixman_format_code_t format;
     int format_type;
-    uint32_t color_masks;
     int a, r, g, b;
     cairo_format_masks_t format_masks;
 


More information about the cairo-commit mailing list