[cairo-commit] Branch '1.10' - 6 commits - build/configure.ac.features src/cairo-analysis-surface.c src/cairo-paginated-surface.c src/cairo-pdf-operators.c src/cairo-pdf-surface.c src/cairo-ps-surface.c src/cairo-type1-fallback.c

Adrian Johnson ajohnson at kemper.freedesktop.org
Sun Nov 21 02:28:41 PST 2010


 build/configure.ac.features   |    2 +-
 src/cairo-analysis-surface.c  |   40 ++++++++++------------------------------
 src/cairo-paginated-surface.c |   28 ++++++++++++++++++++++++++++
 src/cairo-pdf-operators.c     |   31 ++++++++++++++++++-------------
 src/cairo-pdf-surface.c       |   10 ++++++++--
 src/cairo-ps-surface.c        |   15 ++++++---------
 src/cairo-type1-fallback.c    |    8 ++++----
 7 files changed, 75 insertions(+), 59 deletions(-)

New commits:
commit b8347e33539402ef64d652bc0f67522e4d02d51c
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sun Nov 21 00:37:29 2010 +1030

    PS: Fix regression - incorrect EPS bounding box
    
        https://bugs.freedesktop.org/show_bug.cgi?id=24688
    (cherry picked from commit bb4055dac6a937b3412170a332b5effe4bbeff7d)

diff --git a/src/cairo-analysis-surface.c b/src/cairo-analysis-surface.c
index a615149..6bec205 100644
--- a/src/cairo-analysis-surface.c
+++ b/src/cairo-analysis-surface.c
@@ -438,27 +438,14 @@ _cairo_analysis_surface_stroke (void			*abstract_surface,
 
     if (_cairo_operator_bounded_by_mask (op)) {
 	cairo_rectangle_int_t mask_extents;
+	cairo_status_t status;
 
-	/* If the backend can handle the stroke, then mark the approximate
-	 * extents of the operation. However, if we need to fallback in order
-	 * to draw the stroke, then ensure that the fallback is as tight as
-	 * possible -- both to minimise output file size and to ensure good
-	 * quality printed output for neighbouring regions.
-	 */
-	if (backend_status == CAIRO_STATUS_SUCCESS) {
-	    _cairo_path_fixed_approximate_stroke_extents (path,
-							  style, ctm,
-							  &mask_extents);
-	} else {
-	    cairo_status_t status;
-
-	    status = _cairo_path_fixed_stroke_extents (path, style,
-						       ctm, ctm_inverse,
-						       tolerance,
-						       &mask_extents);
-	    if (unlikely (status))
-		return status;
-	}
+	status = _cairo_path_fixed_stroke_extents (path, style,
+						   ctm, ctm_inverse,
+						   tolerance,
+						   &mask_extents);
+	if (unlikely (status))
+	    return status;
 
 	is_empty = _cairo_rectangle_intersect (&extents, &mask_extents);
     }
@@ -503,16 +490,9 @@ _cairo_analysis_surface_fill (void			*abstract_surface,
     if (_cairo_operator_bounded_by_mask (op)) {
 	cairo_rectangle_int_t mask_extents;
 
-	/* We want speed for the likely case where the operation can be
-	 * performed natively, but accuracy if we have to resort to
-	 * using images.
-	 */
-	if (backend_status == CAIRO_STATUS_SUCCESS) {
-	    _cairo_path_fixed_approximate_fill_extents (path, &mask_extents);
-	} else {
-	     _cairo_path_fixed_fill_extents (path, fill_rule, tolerance,
-					     &mask_extents);
-	}
+	_cairo_path_fixed_fill_extents (path, fill_rule, tolerance,
+					&mask_extents);
+
 	is_empty = _cairo_rectangle_intersect (&extents, &mask_extents);
     }
 
commit cfff4f30a0eaa29b817cb32616c2da5a27921332
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Nov 20 23:54:00 2010 +1030

    PS: Fix regression - missing page content in EPS output
    
    https://bugs.freedesktop.org/show_bug.cgi?id=24688
    (cherry picked from commit d3746448d78fcedf8f8f9a7d0fca47f1bd6a5b67)

diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index 1c2edbe..3ce5437 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -3508,9 +3508,6 @@ _cairo_ps_surface_paint (void			*abstract_surface,
     if (unlikely (status))
 	return status;
 
-    if (! _cairo_rectangle_intersect (&extents.bounded, &surface->page_bbox))
-	return CAIRO_STATUS_SUCCESS;
-
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_ps_surface_analyze_operation (surface, op, source, &extents.bounded);
 
@@ -3579,9 +3576,6 @@ _cairo_ps_surface_stroke (void			*abstract_surface,
     if (unlikely (status))
 	return status;
 
-    if (! _cairo_rectangle_intersect (&extents.bounded, &surface->page_bbox))
-	return CAIRO_STATUS_SUCCESS;
-
     /* use the more accurate extents */
     if (extents.is_bounded) {
 	status = _cairo_path_fixed_stroke_extents (path, style,
@@ -3643,9 +3637,6 @@ _cairo_ps_surface_fill (void		*abstract_surface,
     if (unlikely (status))
 	return status;
 
-    if (! _cairo_rectangle_intersect (&extents.bounded, &surface->page_bbox))
-	return CAIRO_STATUS_SUCCESS;
-
     /* use the more accurate extents */
     if (extents.is_bounded) {
 	_cairo_path_fixed_fill_extents (path,
commit ed87ddddb3994f126e0f2d18fa23da6bc5ed579e
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Nov 20 00:50:04 2010 +1030

    PS/PDF: Fix regression when changing page size to a larger size
    
    https://bugs.freedesktop.org/show_bug.cgi?id=24691
    (cherry picked from commit e7c5f470436220668e50201d775a9fec47162a67)

diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index af4790e..9e65f7b 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -151,6 +151,34 @@ _cairo_paginated_surface_get_target (cairo_surface_t *surface)
     return paginated_surface->target;
 }
 
+cairo_status_t
+_cairo_paginated_surface_set_size (cairo_surface_t	*surface,
+				   int			 width,
+				   int			 height)
+{
+    cairo_paginated_surface_t *paginated_surface;
+    cairo_status_t status;
+    cairo_rectangle_t recording_extents;
+
+    assert (_cairo_surface_is_paginated (surface));
+
+    paginated_surface = (cairo_paginated_surface_t *) surface;
+
+    recording_extents.x = 0;
+    recording_extents.y = 0;
+    recording_extents.width = width;
+    recording_extents.height = height;
+
+    cairo_surface_destroy (paginated_surface->recording_surface);
+    paginated_surface->recording_surface = cairo_recording_surface_create (paginated_surface->content,
+									   &recording_extents);
+    status = paginated_surface->recording_surface->status;
+    if (unlikely (status))
+	return _cairo_surface_set_error (surface, status);
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
 static cairo_status_t
 _cairo_paginated_surface_finish (void *abstract_surface)
 {
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index ae2e4f5..0f41713 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -645,6 +645,7 @@ cairo_pdf_surface_set_size (cairo_surface_t	*surface,
 			    double		 height_in_points)
 {
     cairo_pdf_surface_t *pdf_surface = NULL; /* hide compiler warning */
+    cairo_status_t status;
 
     if (! _extract_pdf_surface (surface, &pdf_surface))
 	return;
@@ -652,6 +653,11 @@ cairo_pdf_surface_set_size (cairo_surface_t	*surface,
     _cairo_pdf_surface_set_size_internal (pdf_surface,
 					  width_in_points,
 					  height_in_points);
+    status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
+						width_in_points,
+						height_in_points);
+    if (status)
+	status = _cairo_surface_set_error (surface, status);
 }
 
 static void
@@ -1720,8 +1726,6 @@ _cairo_pdf_surface_finish (void *abstract_surface)
 	surface->font_subsets = NULL;
     }
 
-    _cairo_surface_clipper_reset (&surface->clipper);
-
     return status;
 }
 
@@ -3571,6 +3575,8 @@ _cairo_pdf_surface_show_page (void *abstract_surface)
     if (unlikely (status))
 	return status;
 
+    _cairo_surface_clipper_reset (&surface->clipper);
+
     status = _cairo_pdf_surface_write_page (surface);
     if (unlikely (status))
 	return status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index c73214e..1c2edbe 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -1303,6 +1303,7 @@ cairo_ps_surface_set_size (cairo_surface_t	*surface,
 			   double		 height_in_points)
 {
     cairo_ps_surface_t *ps_surface = NULL;
+    cairo_status_t status;
 
     if (! _extract_ps_surface (surface, TRUE, &ps_surface))
 	return;
@@ -1312,6 +1313,11 @@ cairo_ps_surface_set_size (cairo_surface_t	*surface,
     cairo_matrix_init (&ps_surface->cairo_to_ps, 1, 0, 0, -1, 0, height_in_points);
     _cairo_pdf_operators_set_cairo_to_pdf_matrix (&ps_surface->pdf_operators,
 						  &ps_surface->cairo_to_ps);
+    status = _cairo_paginated_surface_set_size (ps_surface->paginated_surface,
+						width_in_points,
+						height_in_points);
+    if (status)
+	status = _cairo_surface_set_error (surface, status);
 }
 
 /**
commit ccff76433e1cd068e5534d0ab633c27b0faf47d2
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Wed Nov 10 20:09:53 2010 +1030

    PDF: Restrict ActualText to PDF version >= 1.5
    
    The use of ActualText in a marked content sequence is a PDF 1.5
    feature.
    
    A 'use_actual_text' flag linked to the PDF version has already been
    implemented in pdf-operators but for some reason this flag had not
    been used to control the use of ActualText.
    (cherry picked from commit 3afd7cd031ab9097e37c3e89d86ec41d015fdeb8)

diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index f60fbef..8d7a97d 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -1287,7 +1287,7 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 {
     cairo_scaled_font_subsets_glyph_t subset_glyph;
     cairo_glyph_t *cur_glyph;
-    cairo_status_t status;
+    cairo_status_t status = CAIRO_STATUS_SUCCESS;
     int i;
 
     /* If the cluster maps 1 glyph to 1 or more unicode characters, we
@@ -1322,15 +1322,17 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 	}
     }
 
-    /* Fallback to using ActualText to map zero or more glyphs to a
-     * unicode string. */
-    status = _cairo_pdf_operators_flush_glyphs (pdf_operators);
-    if (unlikely (status))
-	return status;
+    if (pdf_operators->use_actual_text) {
+	/* Fallback to using ActualText to map zero or more glyphs to a
+	 * unicode string. */
+	status = _cairo_pdf_operators_flush_glyphs (pdf_operators);
+	if (unlikely (status))
+	    return status;
 
-    status = _cairo_pdf_operators_begin_actualtext (pdf_operators, utf8, utf8_len);
-    if (unlikely (status))
-	return status;
+	status = _cairo_pdf_operators_begin_actualtext (pdf_operators, utf8, utf8_len);
+	if (unlikely (status))
+	    return status;
+    }
 
     cur_glyph = glyphs;
     /* XXX
@@ -1355,11 +1357,14 @@ _cairo_pdf_operators_emit_cluster (cairo_pdf_operators_t      *pdf_operators,
 	else
 	    cur_glyph++;
     }
-    status = _cairo_pdf_operators_flush_glyphs (pdf_operators);
-    if (unlikely (status))
-	return status;
 
-    status = _cairo_pdf_operators_end_actualtext (pdf_operators);
+    if (pdf_operators->use_actual_text) {
+	status = _cairo_pdf_operators_flush_glyphs (pdf_operators);
+	if (unlikely (status))
+	    return status;
+
+	status = _cairo_pdf_operators_end_actualtext (pdf_operators);
+    }
 
     return status;
 }
commit e0967ff83c24aaf6d6b3a93a627872820be9012b
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Nov 6 21:15:30 2010 +1030

    Fix type1-fallback bbox
    (cherry picked from commit 74873c82242e9c124b69e05d0f8abdf78983d62d)

diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index b93c423..ef25fb6 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -755,10 +755,10 @@ _cairo_type1_fallback_init_internal (cairo_type1_subset_t	*type1_subset,
     len = snprintf(type1_subset->data + font->bbox_position,
                    font->bbox_max_chars,
                    "%d %d %d %d",
-                   (int)type1_subset->x_min,
-                   (int)type1_subset->y_min,
-                   (int)type1_subset->x_max,
-                   (int)type1_subset->y_max);
+                   (int)font->x_min,
+                   (int)font->y_min,
+                   (int)font->x_max,
+                   (int)font->y_max);
     type1_subset->data[font->bbox_position + len] = ' ';
 
     type1_subset->header_length = font->header_size;
commit 1413a44f64982e5196ca338c7cee5dfe19cd4b40
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Sat Nov 6 18:44:54 2010 +1030

    configure.ac.features: s/Meta/Recording/
    (cherry picked from commit 8f2f5e5ad4f8e5f18da903865bb2d2afce3a544e)

diff --git a/build/configure.ac.features b/build/configure.ac.features
index 176349e..825fd96 100644
--- a/build/configure.ac.features
+++ b/build/configure.ac.features
@@ -364,7 +364,7 @@ AC_DEFUN([CAIRO_REPORT],
 	echo ""
 	echo "The following surface backends:"
 	echo "  Image:         yes (always builtin)"
-	echo "  Meta:          yes (always builtin)"
+	echo "  Recording:     yes (always builtin)"
 	echo "  Tee:           yes (always builtin)"
 	echo "  XML:           $use_xml"
 	echo "  Skia:          $use_skia"


More information about the cairo-commit mailing list