summaryrefslogtreecommitdiff
path: root/src/cairo-path-fixed.c
diff options
context:
space:
mode:
authorAndrea Canciani <ranma42@gmail.com>2010-10-17 14:10:58 +0200
committerAndrea Canciani <ranma42@gmail.com>2010-10-29 17:31:22 +0200
commita2ac91eb5f66f4c633abbcd6945f6015837ff211 (patch)
tree8e5950ecca2d50d70b6540645244aa5b1e742139 /src/cairo-path-fixed.c
parent2352b48f9e9b54b4586548df74aaaa28d5308c0b (diff)
path: Drop degenerate line_to in _cairo_path_fixed_curve_to
When a degenerate line_to is followed by a curve_to operation, the line_to can be safely dropped, just like for degenerate line_to followed by line_to.
Diffstat (limited to 'src/cairo-path-fixed.c')
-rw-r--r--src/cairo-path-fixed.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index 36e18ec2a..627d2cca5 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -594,6 +594,17 @@ _cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
return status;
}
+ /* If the previous op was a degenerate LINE_TO, drop it. */
+ if (_cairo_path_fixed_last_op (path) == CAIRO_PATH_OP_LINE_TO) {
+ const cairo_point_t *p;
+
+ p = _cairo_path_fixed_penultimate_point (path);
+ if (p->x == path->current_point.x && p->y == path->current_point.y) {
+ /* previous line element was degenerate, replace */
+ _cairo_path_fixed_drop_line_to (path);
+ }
+ }
+
point[0].x = x0; point[0].y = y0;
point[1].x = x1; point[1].y = y1;
point[2].x = x2; point[2].y = y2;