convert pathops to use SkSTArray where possible.
Replace SkTDArray with SkTArray and use SkSTArray when
the probable array size is known.
In a couple of places (spans, chases) the arrays are
constructed using insert() so SkTArrays can't be used for
now.
Also, add an optimization to cubic subdivide if either end
is zero or one.
BUG=
Review URL: https://codereview.chromium.org/16951017
git-svn-id: http://skia.googlecode.com/svn/trunk@9635 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkPathOpsCubic.cpp b/src/pathops/SkPathOpsCubic.cpp
index 5d77e5a..60dca44 100644
--- a/src/pathops/SkPathOpsCubic.cpp
+++ b/src/pathops/SkPathOpsCubic.cpp
@@ -383,8 +383,13 @@
}
SkDCubic SkDCubic::subDivide(double t1, double t2) const {
- if (t1 == 0 && t2 == 1) {
- return *this;
+ if (t1 == 0 || t2 == 1) {
+ if (t1 == 0 && t2 == 1) {
+ return *this;
+ }
+ SkDCubicPair pair = chopAt(t1 == 0 ? t2 : t1);
+ SkDCubic dst = t1 == 0 ? pair.first() : pair.second();
+ return dst;
}
SkDCubic dst;
double ax = dst[0].fX = interp_cubic_coords(&fPts[0].fX, t1);