summaryrefslogtreecommitdiff
path: root/src/cairo-path.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-08-18 06:27:45 -0700
committerCarl Worth <cworth@cworth.org>2006-08-18 06:32:12 -0700
commit53f74e59faf1af78f2f0741ccf1f23aa5dad4efc (patch)
tree913177c33b47d7e85db7d5aceac971333b1a841a /src/cairo-path.c
parent200a2d811efab2e48d6b584b9da202effaddf99f (diff)
downloadcairo-53f74e59faf1af78f2f0741ccf1f23aa5dad4efc.tar.gz
Fix close-path failure by adding explicit move_to after close_path.
Besides the bug fix, this is a user-visible change since the new move_to element after the close_path element can be seen in the results of cairo_copy_path, so we document that here. We are also careful to fix up _cairo_path_fixed_line_to to defer to _cairo_path_fixed_move_to to avoid letting the last_move_point state get stale. This avoids introducing the second bug that is also tested by the close-path test case.
Diffstat (limited to 'src/cairo-path.c')
-rw-r--r--src/cairo-path.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/cairo-path.c b/src/cairo-path.c
index b0c094ed1..9549f8d3f 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -228,8 +228,13 @@ _cairo_path_fixed_line_to (cairo_path_fixed_t *path,
point.x = x;
point.y = y;
+ /* When there is not yet a current point, the line_to operation
+ * becomes a move_to instead. Note: We have to do this by
+ * explicitly calling into _cairo_path_fixed_line_to to ensure
+ * that the last_move_point state is updated properly.
+ */
if (! path->has_current_point)
- status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_MOVE_TO, &point, 1);
+ status = _cairo_path_fixed_move_to (path, point.x, point.y);
else
status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_LINE_TO, &point, 1);
@@ -328,9 +333,11 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path)
if (status)
return status;
- path->current_point.x = path->last_move_point.x;
- path->current_point.y = path->last_move_point.y;
- path->has_current_point = TRUE;
+ status = _cairo_path_fixed_move_to (path,
+ path->last_move_point.x,
+ path->last_move_point.y);
+ if (status)
+ return status;
return CAIRO_STATUS_SUCCESS;
}