From 94a9e06a930ba985de461826ea3e64fd7c222bc6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 12 Mar 2012 18:41:45 +0000 Subject: [PATCH] clip: Intialise polygon fill-rule prior to use The earliest use of the clip path's polygon fill rule is now for intersecting the original polygon with the plurality of clip boxes. However, the initialisation of the fill rule remained after the intersection. ==8968== Conditional jump or move depends on uninitialised value(s) ==8968== at 0x4C99449: _cairo_polygon_intersect (cairo-polygon-intersect.c:1382) ==8968== by 0x4C9B788: _cairo_polygon_intersect_with_boxes.part.12 (cairo-polygon-intersect.c:1520) ==8968== by 0x4C6AE6E: _cairo_clip_get_polygon (cairo-clip-polygon.c:104) ==8968== by 0x4CAA667: clip_and_composite_boxes.part.13 (cairo-spans-compositor.c:773) ==8968== by 0x4CAAD1D: clip_and_composite_boxes (cairo-spans-compositor.c:758) ==8968== by 0x4CAB25C: _cairo_spans_compositor_fill (cairo-spans-compositor.c:1023) ==8968== by 0x4C6CB69: _cairo_compositor_fill (cairo-compositor.c:184) ==8968== by 0x4C7CE3E: _cairo_image_surface_fill (cairo-image-surface.c:945) ==8968== by 0x4CAE2B6: _cairo_surface_fill (cairo-surface.c:2047) ==8968== by 0x4C74AB7: _cairo_gstate_fill (cairo-gstate.c:1268) ==8968== by 0x4C6E6D3: _cairo_default_context_fill (cairo-default-context.c:1009) ==8968== by 0x4C67944: cairo_fill (cairo.c:2105) Signed-off-by: Chris Wilson --- src/cairo-clip-polygon.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cairo-clip-polygon.c b/src/cairo-clip-polygon.c index db0298f6e..d5208d303 100644 --- a/src/cairo-clip-polygon.c +++ b/src/cairo-clip-polygon.c @@ -94,6 +94,9 @@ _cairo_clip_get_polygon (const cairo_clip_t *clip, _cairo_polygon_init_with_clip (polygon, NULL); clip_path = clip->path; + *fill_rule = clip_path->fill_rule; + *antialias = clip_path->antialias; + status = _cairo_path_fixed_fill_to_polygon (&clip_path->path, clip_path->tolerance, polygon); @@ -110,8 +113,6 @@ _cairo_clip_get_polygon (const cairo_clip_t *clip, polygon->limits = NULL; polygon->num_limits = 0; - *fill_rule = clip_path->fill_rule; - *antialias = clip_path->antialias; while ((clip_path = clip_path->prev) != NULL) { cairo_polygon_t next;