From 5de955853365a526fca439e50b8d043a759e64ef Mon Sep 17 00:00:00 2001 From: iconexperience Date: Sat, 16 Jan 2016 15:05:49 +0100 Subject: [PATCH] Add performance improvement of _getMonoCurves() by filtering curves that have end points and control points sorted in y direction. --- src/path/PathItem.Boolean.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/path/PathItem.Boolean.js b/src/path/PathItem.Boolean.js index a504dc38..d1994e3f 100644 --- a/src/path/PathItem.Boolean.js +++ b/src/path/PathItem.Boolean.js @@ -924,8 +924,10 @@ Path.inject(/** @lends Path# */{ y1 = v[3], y2 = v[5], y3 = v[7]; - if (Curve.isStraight(v)) { - // Handling straight curves is easy. + if (Curve.isStraight(v) || + y0 >= y1 === y1 >= y2 && y1 >= y2 === y2 >= y3) { + // Straight curves and curves with end and control points sorted + // in y direction are guaranteed to be monotone in y direction. insertCurve(v); } else { // Split the curve at y extrema, to get bezier curves with clear