From b09f49182f27fb482ec8f2713f5f16d98720341d 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, 10 insertions(+), 2 deletions(-) diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c index 459c680..263aecb 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,13 @@ _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->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