[cairo-commit] 5 commits - src/cairoint.h src/cairo-pdf-surface.c src/cairo-recording-surface.c src/cairo-surface.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Aug 13 04:05:18 PDT 2011


 src/cairo-pdf-surface.c       |   50 +++++---------------------------
 src/cairo-recording-surface.c |    4 +-
 src/cairo-surface.c           |   65 ++++++++++++++++++++----------------------
 src/cairoint.h                |    4 +-
 4 files changed, 45 insertions(+), 78 deletions(-)

New commits:
commit 487c5e4d3a5aa5e723bd7b5d418a6b7a9313f5a8
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 13 11:54:19 2011 +0100

    recording: replay_all is meant to mean REPLAY && ALL!
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index 791c5b0..87b9119 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -1230,7 +1230,7 @@ _cairo_recording_surface_replay_internal (cairo_recording_surface_t	*surface,
     cairo_command_t **elements;
     cairo_bool_t replay_all =
 	type == CAIRO_RECORDING_REPLAY &&
-	region != CAIRO_RECORDING_REGION_ALL;
+	region == CAIRO_RECORDING_REGION_ALL;
     cairo_int_status_t status = CAIRO_STATUS_SUCCESS;
     cairo_rectangle_int_t extents;
     cairo_bool_t use_indices = FALSE;
commit 73b87334a401a7705f674429d55bb5d0bc559c17
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 13 11:48:37 2011 +0100

    surface: Don't modify operator
    
    Specifically don't transform SOURCE into a CLEAR as the paginated
    backends may not be able to handle the new operator.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 899d518..298e96b 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -2226,6 +2226,23 @@ _pattern_has_error (const cairo_pattern_t *pattern)
     return CAIRO_STATUS_SUCCESS;
 }
 
+static cairo_bool_t
+nothing_to_do (cairo_surface_t *surface,
+	       cairo_operator_t op,
+	       const cairo_pattern_t *source)
+{
+    if (op == CAIRO_OPERATOR_SOURCE && _cairo_pattern_is_clear (source))
+	op = CAIRO_OPERATOR_CLEAR;
+
+    if (op == CAIRO_OPERATOR_CLEAR && surface->is_clear)
+	return TRUE;
+
+    if (op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_clear (source))
+	return TRUE;
+
+    return FALSE;
+}
+
 cairo_status_t
 _cairo_surface_paint (cairo_surface_t		*surface,
 		      cairo_operator_t		 op,
@@ -2240,13 +2257,7 @@ _cairo_surface_paint (cairo_surface_t		*surface,
     if (_cairo_clip_is_all_clipped (clip))
 	return CAIRO_STATUS_SUCCESS;
 
-    if (op == CAIRO_OPERATOR_SOURCE && _cairo_pattern_is_clear (source))
-	op = CAIRO_OPERATOR_CLEAR;
-
-    if (op == CAIRO_OPERATOR_CLEAR && surface->is_clear)
-	return CAIRO_STATUS_SUCCESS;
-
-    if (op == CAIRO_OPERATOR_OVER && _cairo_pattern_is_clear (source))
+    if (nothing_to_do (surface, op, source))
 	return CAIRO_STATUS_SUCCESS;
 
     status = _pattern_has_error (source);
@@ -2285,7 +2296,7 @@ _cairo_surface_mask (cairo_surface_t		*surface,
     if (_cairo_clip_is_all_clipped (clip))
 	return CAIRO_STATUS_SUCCESS;
 
-    if (op == CAIRO_OPERATOR_CLEAR && surface->is_clear)
+    if (nothing_to_do (surface, op, source))
 	return CAIRO_STATUS_SUCCESS;
 
     /* If the mask is blank, this is just an expensive no-op */
@@ -2295,12 +2306,6 @@ _cairo_surface_mask (cairo_surface_t		*surface,
 	return CAIRO_STATUS_SUCCESS;
     }
 
-    if (op == CAIRO_OPERATOR_OVER &&
-	_cairo_pattern_is_clear (source))
-    {
-	return CAIRO_STATUS_SUCCESS;
-    }
-
     status = _pattern_has_error (source);
     if (unlikely (status))
 	return status;
@@ -2426,15 +2431,9 @@ _cairo_surface_stroke (cairo_surface_t		*surface,
     if (_cairo_clip_is_all_clipped (clip))
 	return CAIRO_STATUS_SUCCESS;
 
-    if (op == CAIRO_OPERATOR_CLEAR && surface->is_clear)
+    if (nothing_to_do (surface, op, source))
 	return CAIRO_STATUS_SUCCESS;
 
-    if (op == CAIRO_OPERATOR_OVER &&
-	_cairo_pattern_is_clear (source))
-    {
-	return CAIRO_STATUS_SUCCESS;
-    }
-
     status = _pattern_has_error (source);
     if (unlikely (status))
 	return status;
@@ -2483,14 +2482,8 @@ _cairo_surface_fill (cairo_surface_t	*surface,
     if (_cairo_clip_is_all_clipped (clip))
 	return CAIRO_STATUS_SUCCESS;
 
-    if (op == CAIRO_OPERATOR_CLEAR && surface->is_clear)
-	return CAIRO_STATUS_SUCCESS;
-
-    if (op == CAIRO_OPERATOR_OVER &&
-	_cairo_pattern_is_clear (source))
-    {
+    if (nothing_to_do (surface, op, source))
 	return CAIRO_STATUS_SUCCESS;
-    }
 
     status = _pattern_has_error (source);
     if (unlikely (status))
commit a37ed264ed96d1b9f5ebc634d64137b71872c762
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 13 11:38:03 2011 +0100

    pdf: Propagate NOTHING_TO_DO
    
    It is taken care of by the higher layers.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 0af638f..3a10ef3 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -5830,12 +5830,8 @@ _cairo_pdf_surface_paint (void			*abstract_surface,
     _cairo_pdf_surface_get_extents (surface, &unbounded);
     status = _cairo_composite_rectangles_init_for_paint (&extents, &unbounded,
 							 op, source, clip);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return CAIRO_INT_STATUS_SUCCESS;
-
+    if (unlikely (status))
 	return status;
-    }
 
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
 	return _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
@@ -5878,8 +5874,6 @@ _cairo_pdf_surface_paint (void			*abstract_surface,
     status = _cairo_pdf_surface_add_pdf_pattern (surface, source,
 						 &extents.bounded,
 						 &pattern_res, &gstate_res);
-    if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
-	return CAIRO_STATUS_SUCCESS;
     if (unlikely (status))
 	return status;
 
@@ -5947,12 +5941,8 @@ _cairo_pdf_surface_mask (void			*abstract_surface,
     _cairo_pdf_surface_get_extents (surface, &unbounded);
     status = _cairo_composite_rectangles_init_for_mask (&extents, &unbounded,
 							op, source, mask, clip);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return CAIRO_STATUS_SUCCESS;
-
+    if (unlikely (status))
 	return status;
-    }
 
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
 	cairo_status_t source_status, mask_status;
@@ -6064,12 +6054,8 @@ _cairo_pdf_surface_stroke (void			*abstract_surface,
 							  op, source,
 							  path, style, ctm,
 							  clip);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return CAIRO_INT_STATUS_SUCCESS;
-
+    if (unlikely (status))
 	return status;
-    }
 
     /* use the more accurate extents */
     if (extents.is_bounded) {
@@ -6098,8 +6084,6 @@ _cairo_pdf_surface_stroke (void			*abstract_surface,
     status = _cairo_pdf_surface_add_pdf_pattern (surface, source,
 						 &extents.bounded,
 						 &pattern_res, &gstate_res);
-    if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
-	return CAIRO_INT_STATUS_SUCCESS;
     if (unlikely (status))
 	return status;
 
@@ -6192,12 +6176,8 @@ _cairo_pdf_surface_fill (void			*abstract_surface,
     status = _cairo_composite_rectangles_init_for_fill (&extents, &unbounded,
 							op, source, path,
 							clip);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return CAIRO_INT_STATUS_SUCCESS;
-
+    if (unlikely (status))
 	return status;
-    }
 
     /* use the more accurate extents */
     if (extents.is_bounded) {
@@ -6257,8 +6237,6 @@ _cairo_pdf_surface_fill (void			*abstract_surface,
     status = _cairo_pdf_surface_add_pdf_pattern (surface, source,
 						 &extents.bounded,
 						 &pattern_res, &gstate_res);
-    if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
-	return CAIRO_INT_STATUS_SUCCESS;
     if (unlikely (status))
 	return status;
 
@@ -6379,10 +6357,8 @@ _cairo_pdf_surface_fill_stroke (void			*abstract_surface,
     status = _cairo_composite_rectangles_init_for_fill (&extents, &unbounded,
 							fill_op, fill_source, path,
 							clip);
-    if (unlikely (status)) {
-	if (status != CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return status;
-    }
+    if (unlikely (status))
+	return status;
 
     /* use the more accurate extents */
     if (extents.is_bounded) {
@@ -6409,10 +6385,8 @@ _cairo_pdf_surface_fill_stroke (void			*abstract_surface,
 							  stroke_op, stroke_source,
 							  path, stroke_style, stroke_ctm,
 							  clip);
-    if (unlikely (status)) {
-	if (status != CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return status;
-    }
+    if (unlikely (status))
+	return status;
 
     /* use the more accurate extents */
     if (extents.is_bounded) {
@@ -6501,12 +6475,8 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
 							  glyphs, num_glyphs,
 							  clip,
 							  &overlap);
-    if (unlikely (status)) {
-	if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
-	    return CAIRO_INT_STATUS_SUCCESS;
-
+    if (unlikely (status))
 	return status;
-    }
 
     if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
 	return _cairo_pdf_surface_analyze_operation (surface, op, source, &extents.bounded);
@@ -6522,8 +6492,6 @@ _cairo_pdf_surface_show_text_glyphs (void			*abstract_surface,
     status = _cairo_pdf_surface_add_pdf_pattern (surface, source,
 						 &extents.bounded,
 						 &pattern_res, &gstate_res);
-    if (unlikely (status == CAIRO_INT_STATUS_NOTHING_TO_DO))
-	return CAIRO_INT_STATUS_SUCCESS;
     if (unlikely (status))
 	return status;
 
commit dea24ef012360877d8c363d283834e76d9938dbb
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 13 11:30:25 2011 +0100

    surface: propagate internal statuses
    
    They are internal and used as such, but we still need to prevent them
    from escaping into the public domain.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index db127fb..899d518 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -166,13 +166,19 @@ static DEFINE_NIL_SURFACE(CAIRO_STATUS_DEVICE_ERROR, _cairo_surface_nil_device_e
  *
  * Return value: the error status.
  **/
-cairo_status_t
+cairo_int_status_t
 _cairo_surface_set_error (cairo_surface_t *surface,
-			  cairo_status_t status)
+			  cairo_int_status_t status)
 {
-    if (status == CAIRO_STATUS_SUCCESS ||
-        status == (int)CAIRO_INT_STATUS_NOTHING_TO_DO)
-        return CAIRO_STATUS_SUCCESS;
+    /* NOTHING_TO_DO is magic. We use it to break out of the inner-most
+     * surface function, but anything higher just sees "success".
+     */
+    if (status == CAIRO_INT_STATUS_NOTHING_TO_DO)
+	status = CAIRO_INT_STATUS_SUCCESS;
+
+    if (status == CAIRO_INT_STATUS_SUCCESS ||
+        status >= (int)CAIRO_INT_STATUS_LAST_STATUS)
+        return status;
 
     /* Don't overwrite an existing error. This preserves the first
      * error, which is the most significant. */
diff --git a/src/cairoint.h b/src/cairoint.h
index 86688a2..8d87aa5 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1600,9 +1600,9 @@ cairo_private cairo_status_t
 _cairo_surface_copy_mime_data (cairo_surface_t *dst,
 			       cairo_surface_t *src);
 
-cairo_private cairo_status_t
+cairo_private cairo_int_status_t
 _cairo_surface_set_error (cairo_surface_t	*surface,
-			  cairo_status_t	 status);
+			  cairo_int_status_t	 status);
 
 cairo_private void
 _cairo_surface_set_resolution (cairo_surface_t *surface,
commit ed324fb3a114faeab4b7844869d2269892a2417e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Aug 13 11:21:20 2011 +0100

    recording-surface: Don't store the transient error when returning the path
    
    As we report the status back to the caller who then decides whether to
    take appropriate action.
    
    "Fixes" user-font.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index b6df3cc..791c5b0 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -1193,7 +1193,7 @@ _cairo_recording_surface_get_path (cairo_surface_t    *abstract_surface,
 	    break;
     }
 
-    return _cairo_surface_set_error (&surface->base, status);
+    return status;
 }
 
 static int


More information about the cairo-commit mailing list