diff options
author | caryclark <caryclark@google.com> | 2015-04-20 08:31:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-20 08:31:59 -0700 |
commit | 1049f1246e7be4ccb68001361efceb8933e6f81c (patch) | |
tree | 9c71ceb245856cbe2173913eaec3b0ebb490dd74 /src/pathops/SkPathOpsRect.cpp | |
parent | 5c476fb2776639bdbf0e974dd38d1c5d4c4ff1aa (diff) |
Now, path ops natively intersect conics, quads, and cubics in any combination. There are still a class of cubic tests that fail and a handful of undiagnosed failures from skps and fuzz tests, but things are much better overall.
Extended tests (150M+) run to completion in release in about 6 minutes; the standard test suite exceeds 100K and finishes in a few seconds on desktops.
TBR=reed
BUG=skia:3588
Review URL: https://codereview.chromium.org/1037953004
Diffstat (limited to 'src/pathops/SkPathOpsRect.cpp')
-rw-r--r-- | src/pathops/SkPathOpsRect.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/pathops/SkPathOpsRect.cpp b/src/pathops/SkPathOpsRect.cpp index 5dd3d8def5..540db16a0e 100644 --- a/src/pathops/SkPathOpsRect.cpp +++ b/src/pathops/SkPathOpsRect.cpp @@ -4,6 +4,7 @@ * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ +#include "SkPathOpsConic.h" #include "SkPathOpsCubic.h" #include "SkPathOpsLine.h" #include "SkPathOpsQuad.h" @@ -25,6 +26,22 @@ void SkDRect::setBounds(const SkDQuad& quad) { } } +void SkDRect::setBounds(const SkDConic& conic) { + set(conic[0]); + add(conic[2]); + double tValues[2]; + int roots = 0; + if (!between(conic[0].fX, conic[1].fX, conic[2].fX)) { + roots = SkDConic::FindExtrema(&conic[0].fX, conic.fWeight, tValues); + } + if (!between(conic[0].fY, conic[1].fY, conic[2].fY)) { + roots += SkDConic::FindExtrema(&conic[0].fY, conic.fWeight, &tValues[roots]); + } + for (int x = 0; x < roots; ++x) { + add(conic.ptAtT(tValues[x])); + } +} + static bool is_bounded_by_end_points(double a, double b, double c, double d) { return between(a, b, d) && between(a, c, d); } |