[cairo] [PATCH 35/41] drm/i915: replace use of _cairo_clip_to_boxes()
Enrico Weigelt, metux IT consult
enrico.weigelt at gr13.net
Thu Dec 10 14:17:11 PST 2015
_cairo_clip_to_boxes() doesnt exist anymore, but we also dont need to copy box lists at all.
Signed-off-by: Enrico Weigelt, metux IT consult <enrico.weigelt at gr13.net>
---
src/drm/cairo-drm-i915-surface.c | 37 ++++++++-----------------------------
1 file changed, 8 insertions(+), 29 deletions(-)
diff --git a/src/drm/cairo-drm-i915-surface.c b/src/drm/cairo-drm-i915-surface.c
index 8da17c0..d64fab5 100644
--- a/src/drm/cairo-drm-i915-surface.c
+++ b/src/drm/cairo-drm-i915-surface.c
@@ -102,6 +102,7 @@
#include "cairo-boxes-private.h"
#include "cairo-cache-private.h"
+#include "cairo-clip-inline.h"
#include "cairo-composite-rectangles-private.h"
#include "cairo-default-context-private.h"
#include "cairo-error-private.h"
@@ -1872,9 +1873,7 @@ i915_surface_fill_with_alpha (void *abstract_dst,
i915_surface_t *dst = abstract_dst;
cairo_composite_rectangles_t extents;
composite_polygon_info_t info;
- cairo_box_t boxes_stack[32], *clip_boxes = boxes_stack;
cairo_clip_t *local_clip = NULL;
- int num_boxes = ARRAY_LENGTH (boxes_stack);
cairo_int_status_t status;
status = _cairo_composite_rectangles_init_for_fill (&extents,
@@ -1903,7 +1902,6 @@ i915_surface_fill_with_alpha (void *abstract_dst,
if (clip != NULL)
clip = local_clip = _cairo_clip_copy (clip);
- status = _cairo_clip_to_boxes (&clip, &extents, &clip_boxes, &num_boxes);
if (unlikely (status)) {
_cairo_clip_destroy (local_clip);
@@ -1916,7 +1914,7 @@ i915_surface_fill_with_alpha (void *abstract_dst,
cairo_boxes_t boxes;
_cairo_boxes_init (&boxes);
- _cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
+ _cairo_boxes_limit (&boxes, extents.clip->boxes, extents.clip->num_boxes);
cairo_status_t stat = _cairo_path_fixed_fill_rectilinear_to_boxes (path,
fill_rule,
CAIRO_ANTIALIAS_DEFAULT,
@@ -1934,7 +1932,7 @@ i915_surface_fill_with_alpha (void *abstract_dst,
goto CLEANUP_BOXES;
}
- _cairo_polygon_init (&info.polygon, clip_boxes, num_boxes);
+ _cairo_polygon_init (&info.polygon, extents.clip->boxes, extents.clip->num_boxes);
status = _cairo_path_fixed_fill_to_polygon (path, tolerance, &info.polygon);
if (unlikely (status))
@@ -1965,9 +1963,6 @@ CLEANUP_POLYGON:
_cairo_polygon_fini (&info.polygon);
CLEANUP_BOXES:
- if (clip_boxes != boxes_stack)
- free (clip_boxes);
-
_cairo_clip_destroy (local_clip);
return status;
@@ -1984,9 +1979,6 @@ i915_surface_paint_with_alpha (void *abstract_dst,
cairo_composite_rectangles_t extents;
cairo_clip_t *local_clip;
cairo_clip_path_t *clip_path;
- cairo_boxes_t boxes;
- int num_boxes = ARRAY_LENGTH (boxes.boxes_embedded);
- cairo_box_t *clip_boxes = boxes.boxes_embedded;
cairo_status_t status;
status = _cairo_composite_rectangles_init_for_paint (&extents,
@@ -2003,13 +1995,6 @@ i915_surface_paint_with_alpha (void *abstract_dst,
if (clip != NULL)
clip = local_clip = _cairo_clip_copy (clip);
- status = _cairo_clip_to_boxes (&clip, &extents, &clip_boxes, &num_boxes);
- if (unlikely (status)) {
- _cairo_clip_destroy (local_clip);
-
- return status;
- }
-
/* If the clip cannot be reduced to a set of boxes, we will need to
* use a clipmask. Paint is special as it is the only operation that
* does not implicitly use a mask, so we may be able to reduce this
@@ -2028,13 +2013,12 @@ i915_surface_paint_with_alpha (void *abstract_dst,
}
else
{
- _cairo_boxes_init_for_array (&boxes, clip_boxes, num_boxes);
+ cairo_boxes_t boxes;
+ _cairo_boxes_init_for_array (&boxes, extents.clip->boxes, extents.clip->num_boxes);
status = _clip_and_composite_boxes (dst, op, source,
&boxes, CAIRO_ANTIALIAS_DEFAULT,
&extents, clip, opacity);
}
- if (clip_boxes != boxes.boxes_embedded)
- free (clip_boxes);
_cairo_clip_destroy (local_clip);
@@ -2208,8 +2192,6 @@ i915_surface_stroke (void *abstract_dst,
i915_surface_t *dst = abstract_dst;
cairo_composite_rectangles_t extents;
composite_polygon_info_t info;
- cairo_box_t boxes_stack[32], *clip_boxes = boxes_stack;
- int num_boxes = ARRAY_LENGTH (boxes_stack);
cairo_clip_t *local_clip;
cairo_int_status_t status;
@@ -2230,7 +2212,6 @@ i915_surface_stroke (void *abstract_dst,
if (clip != NULL)
clip = local_clip = _cairo_clip_copy (clip);
- status = _cairo_clip_to_boxes (&clip, &extents, &clip_boxes, &num_boxes);
if (unlikely (status)) {
_cairo_clip_destroy (local_clip);
@@ -2241,12 +2222,13 @@ i915_surface_stroke (void *abstract_dst,
cairo_boxes_t boxes;
_cairo_boxes_init (&boxes);
- _cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
+ _cairo_boxes_limit (&boxes, extents.clip->boxes, extents.clip->num_boxes);
cairo_status_t stat = _cairo_path_fixed_stroke_rectilinear_to_boxes (path,
stroke_style,
ctm,
CAIRO_ANTIALIAS_DEFAULT,
&boxes);
+
if (likely (stat == CAIRO_STATUS_SUCCESS)) {
status = _clip_and_composite_boxes (dst, op, source,
&boxes, antialias,
@@ -2259,7 +2241,7 @@ i915_surface_stroke (void *abstract_dst,
goto CLEANUP_BOXES;
}
- _cairo_polygon_init (&info.polygon, clip_boxes, num_boxes);
+ _cairo_polygon_init (&info.polygon, extents.clip->boxes, extents.clip->num_boxes);
status = _cairo_path_fixed_stroke_to_polygon (path,
stroke_style,
@@ -2294,9 +2276,6 @@ CLEANUP_POLYGON:
_cairo_polygon_fini (&info.polygon);
CLEANUP_BOXES:
- if (clip_boxes != boxes_stack)
- free (clip_boxes);
-
_cairo_clip_destroy (local_clip);
return status;
--
2.6.4.442.g545299f
More information about the cairo
mailing list