[cairo] [PATCH 50/51] core: changed retval of _cairo_composite_rectangles_init_for_mask() to cairo_bool_t
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Fri Dec 18 05:29:29 PST 2015
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
src/cairo-cogl-surface.c | 17 ++++++-----------
src/cairo-composite-rectangles-private.h | 2 +-
src/cairo-composite-rectangles.c | 8 +++-----
src/cairo-compositor.c | 7 +++----
src/cairo-pdf-surface.c | 7 +++----
src/cairo-ps-surface.c | 7 +++----
src/cairo-recording-surface.c | 7 +++----
src/drm/cairo-drm-i915-surface.c | 7 +++----
src/drm/cairo-drm-i965-surface.c | 7 +++----
9 files changed, 28 insertions(+), 41 deletions(-)
diff --git a/src/cairo-cogl-surface.c b/src/cairo-cogl-surface.c
index f61e16c..0ea3988 100644
--- a/src/cairo-cogl-surface.c
+++ b/src/cairo-cogl-surface.c
@@ -1779,7 +1779,6 @@ _cairo_cogl_surface_mask (void *abstract_surface,
{
cairo_cogl_surface_t *surface = abstract_surface;
cairo_composite_rectangles_t extents;
- cairo_status_t status;
CoglPipeline *pipeline;
cairo_matrix_t identity;
@@ -1790,18 +1789,15 @@ _cairo_cogl_surface_mask (void *abstract_surface,
if (!is_operator_supported (op))
return CAIRO_INT_STATUS_UNSUPPORTED;
- status = _cairo_composite_rectangles_init_for_mask (&extents,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents,
&surface->base,
- op, source, mask, clip);
- if (unlikely (status))
- return status;
+ op, source, mask, clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
pipeline = get_source_mask_operator_destination_pipeline (mask, source,
op, surface, &extents);
- if (!pipeline){
- status = CAIRO_INT_STATUS_UNSUPPORTED;
- goto BAIL;
- }
+ if (!pipeline)
+ return CAIRO_INT_STATUS_UNSUPPORTED;
_cairo_cogl_maybe_log_clip (surface, &extents);
@@ -1817,8 +1813,7 @@ _cairo_cogl_surface_mask (void *abstract_surface,
/* The journal will take a reference on the pipeline and clip_path... */
cogl_object_unref (pipeline);
-BAIL:
- return status;
+ return CAIRO_INT_STATUS_SUCCESS;
}
static int
diff --git a/src/cairo-composite-rectangles-private.h b/src/cairo-composite-rectangles-private.h
index fd77289..911ef8b 100644
--- a/src/cairo-composite-rectangles-private.h
+++ b/src/cairo-composite-rectangles-private.h
@@ -82,7 +82,7 @@ _cairo_composite_rectangles_init_for_paint (cairo_composite_rectangles_t *extent
const cairo_pattern_t *source,
const cairo_clip_t *clip);
-cairo_private cairo_int_status_t
+cairo_private cairo_bool_t
_cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents,
cairo_surface_t *surface,
cairo_operator_t op,
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c
index 30c1b6e..d0d32c7 100644
--- a/src/cairo-composite-rectangles.c
+++ b/src/cairo-composite-rectangles.c
@@ -314,7 +314,7 @@ _cairo_composite_rectangles_intersect_mask_extents (cairo_composite_rectangles_t
return CAIRO_INT_STATUS_SUCCESS;
}
-cairo_int_status_t
+cairo_bool_t
_cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents,
cairo_surface_t*surface,
cairo_operator_t op,
@@ -325,16 +325,14 @@ _cairo_composite_rectangles_init_for_mask (cairo_composite_rectangles_t *extents
if (! _cairo_composite_rectangles_init (extents,
surface, op, source, clip))
{
- return CAIRO_INT_STATUS_NOTHING_TO_DO;
+ return 0;
}
extents->original_mask_pattern = mask;
_cairo_composite_reduce_pattern (mask, &extents->mask_pattern);
_cairo_pattern_get_extents (&extents->mask_pattern.base, &extents->mask);
- return (_cairo_composite_rectangles_intersect (extents, clip) ?
- CAIRO_INT_STATUS_SUCCESS :
- CAIRO_INT_STATUS_NOTHING_TO_DO);
+ return _cairo_composite_rectangles_intersect (extents, clip);
}
cairo_int_status_t
diff --git a/src/cairo-compositor.c b/src/cairo-compositor.c
index b31413b..235e54c 100644
--- a/src/cairo-compositor.c
+++ b/src/cairo-compositor.c
@@ -93,11 +93,10 @@ _cairo_compositor_mask (const cairo_compositor_t *compositor,
cairo_int_status_t status;
TRACE ((stderr, "%s\n", __FUNCTION__));
- status = _cairo_composite_rectangles_init_for_mask (&extents, surface,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents, surface,
op, source, mask,
- clip);
- if (unlikely (status))
- return status;
+ clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
do {
while (compositor->mask == NULL)
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index a6274bd..2ba2ffb 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -7075,11 +7075,10 @@ _cairo_pdf_surface_mask (void *abstract_surface,
cairo_rectangle_int_t r;
cairo_box_t box;
- status = _cairo_composite_rectangles_init_for_mask (&extents,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents,
&surface->base,
- op, source, mask, clip);
- if (unlikely (status))
- return status;
+ op, source, mask, clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
cairo_int_status_t source_status, mask_status;
diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c
index fd0d284..70663a2 100644
--- a/src/cairo-ps-surface.c
+++ b/src/cairo-ps-surface.c
@@ -4183,11 +4183,10 @@ _cairo_ps_surface_mask (void *abstract_surface,
cairo_composite_rectangles_t extents;
cairo_status_t status;
- status = _cairo_composite_rectangles_init_for_mask (&extents,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents,
&surface->base,
- op, source, mask, clip);
- if (unlikely (status))
- return status;
+ op, source, mask, clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE) {
status = _cairo_ps_surface_analyze_operation (surface, op, source, mask, &extents.bounded);
diff --git a/src/cairo-recording-surface.c b/src/cairo-recording-surface.c
index c7cd4a1..e53e56c 100644
--- a/src/cairo-recording-surface.c
+++ b/src/cairo-recording-surface.c
@@ -787,12 +787,11 @@ _cairo_recording_surface_mask (void *abstract_surface,
TRACE ((stderr, "%s: surface=%d\n", __FUNCTION__, surface->base.unique_id));
- status = _cairo_composite_rectangles_init_for_mask (&composite,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&composite,
&surface->base,
op, source, mask,
- clip);
- if (unlikely (status))
- return status;
+ clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
command = malloc (sizeof (cairo_command_mask_t));
if (unlikely (command == NULL)) {
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index 675da80..f8277ae 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -2071,14 +2071,13 @@ i915_surface_mask (void *abstract_dst,
return i915_surface_paint_with_alpha (dst, op, source, CAIRO_ANTIALIAS_DEFAULT, clip, solid->color.alpha);
}
- status = _cairo_composite_rectangles_init_for_mask (&extents,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents,
&(dst->intel.drm.base),
op,
source,
mask,
- clip);
- if (unlikely (status))
- return status;
+ clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
if (_cairo_clip_contains_extents (clip, &extents))
clip = NULL;
diff --git a/src/drm/cairo-drm-i965-surface.c b/src/drm/cairo-drm-i965-surface.c
index 793686d..c2c0dfc 100644
--- a/src/drm/cairo-drm-i965-surface.c
+++ b/src/drm/cairo-drm-i965-surface.c
@@ -1133,11 +1133,10 @@ i965_surface_mask (void *abstract_dst,
cairo_region_t *clip_region = NULL;
cairo_status_t status;
- status = _cairo_composite_rectangles_init_for_mask (&extents,
+ if (unlikely(!_cairo_composite_rectangles_init_for_mask (&extents,
&(dst->intel.drm.base),
- op, source, mask, clip);
- if (unlikely (status))
- return status;
+ op, source, mask, clip)))
+ return CAIRO_INT_STATUS_NOTHING_TO_DO;
if (clip != NULL && _cairo_clip_contains_extents (clip, &extents))
clip = NULL;
--
2.6.4.442.g545299f
More information about the cairo
mailing list