From 0caf8e2e8cdba1914636436d5f35a9d1bba15320 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 459c680..1ba767a 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). @@ -679,8 +682,14 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path) * because the path could have been closed with a curve_to (and * 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); + if (_cairo_path_fixed_last_op (path) == CAIRO_PATH_OP_LINE_TO) { + _cairo_path_fixed_drop_line_to (path); + if (!has_extents) { + path->has_extents = FALSE; + 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