From b89f452424da05e2e12f251c858f290c7f9430c1 Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Wed, 5 Sep 2012 16:09:36 +0300 Subject: [PATCH] path-fixed: do not let temporary lines affect path extents A path with only move_to commands should not have an extent after calling cairo_close_path(). --- src/cairo-path-fixed.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 459c680..88138d0 100644 --- a/src/cairo-path-fixed.c +++ b/src/cairo-path-fixed.c @@ -659,10 +659,13 @@ cairo_status_t _cairo_path_fixed_close_path (cairo_path_fixed_t *path) { cairo_status_t status; + cairo_bool_t has_extents; if (! path->has_current_point) return CAIRO_STATUS_SUCCESS; + has_extents = path->has_extents; + /* * Add a line_to, to compute flags and solve any degeneracy. * It will be removed later (if it was actually added). @@ -680,7 +683,14 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path) * the previous line_to not added as it would be degenerate). */ if (_cairo_path_fixed_last_op (path) == CAIRO_PATH_OP_LINE_TO) - _cairo_path_fixed_drop_line_to (path); + { + _cairo_path_fixed_drop_line_to (path); + if (!has_extents) + { + path->extents.p1.x = path->extents.p1.y = 0; + path->extents.p2.x = path->extents.p2.y = 0; + } + } path->needs_move_to = TRUE; /* After close_path, add an implicit move_to */ -- 1.7.10.4