summaryrefslogtreecommitdiff
path: root/src/cairo-polygon.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-10-12 17:04:16 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2011-10-12 17:04:16 +0100
commit8f34fa033e741eed040ff8895fcb94b8507903b8 (patch)
treef58bba2c6747b9879d97758b0855dbe5bacb305e /src/cairo-polygon.c
parentd576319e1346712a54802f372f742a24dbcdadd9 (diff)
downloadcairo-8f34fa033e741eed040ff8895fcb94b8507903b8.tar.gz
spans: Refresh polygon limits after trimming the composite extents
Trimming the composite extents may result in the clip being reconstructed, but we the polygon continued to hold a reference into the freed clip's array of boxes. So if we intend to reuse the polygon limits after performing the clip we need to refresh them. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-polygon.c')
-rw-r--r--src/cairo-polygon.c44
1 files changed, 31 insertions, 13 deletions
diff --git a/src/cairo-polygon.c b/src/cairo-polygon.c
index a44cba3f5..90f81f755 100644
--- a/src/cairo-polygon.c
+++ b/src/cairo-polygon.c
@@ -48,24 +48,12 @@ _cairo_polygon_add_edge (cairo_polygon_t *polygon,
int dir);
void
-_cairo_polygon_init (cairo_polygon_t *polygon,
+_cairo_polygon_limit (cairo_polygon_t *polygon,
const cairo_box_t *limits,
int num_limits)
{
int n;
- VG (VALGRIND_MAKE_MEM_UNDEFINED (polygon, sizeof (cairo_polygon_t)));
-
- polygon->status = CAIRO_STATUS_SUCCESS;
-
- polygon->num_edges = 0;
-
- polygon->edges = polygon->edges_embedded;
- polygon->edges_size = ARRAY_LENGTH (polygon->edges_embedded);
-
- polygon->extents.p1.x = polygon->extents.p1.y = INT32_MAX;
- polygon->extents.p2.x = polygon->extents.p2.y = INT32_MIN;
-
polygon->limits = limits;
polygon->num_limits = num_limits;
@@ -88,6 +76,36 @@ _cairo_polygon_init (cairo_polygon_t *polygon,
}
void
+_cairo_polygon_limit_to_clip (cairo_polygon_t *polygon,
+ const cairo_clip_t *clip)
+{
+ if (clip)
+ _cairo_polygon_limit (polygon, clip->boxes, clip->num_boxes);
+ else
+ _cairo_polygon_limit (polygon, 0, 0);
+}
+
+void
+_cairo_polygon_init (cairo_polygon_t *polygon,
+ const cairo_box_t *limits,
+ int num_limits)
+{
+ VG (VALGRIND_MAKE_MEM_UNDEFINED (polygon, sizeof (cairo_polygon_t)));
+
+ polygon->status = CAIRO_STATUS_SUCCESS;
+
+ polygon->num_edges = 0;
+
+ polygon->edges = polygon->edges_embedded;
+ polygon->edges_size = ARRAY_LENGTH (polygon->edges_embedded);
+
+ polygon->extents.p1.x = polygon->extents.p1.y = INT32_MAX;
+ polygon->extents.p2.x = polygon->extents.p2.y = INT32_MIN;
+
+ _cairo_polygon_limit (polygon, limits, num_limits);
+}
+
+void
_cairo_polygon_init_with_clip (cairo_polygon_t *polygon,
const cairo_clip_t *clip)
{