mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Add performance improvement of _getMonoCurves() by filtering curves that have end points and control points sorted in y direction.
This commit is contained in:
parent
b33777274d
commit
5de9558533
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue