aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pathops/SkDQuadIntersection.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-17 14:10:36 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-17 14:10:36 +0000
commitd892bd8ba676d34d4ce4a73ac7aad88e102fad70 (patch)
treef8b35e6d7582800ef622fc796ef4077163763a05 /src/pathops/SkDQuadIntersection.cpp
parentacb3d88cf84adf367c173a7a33cd3b0c379291dc (diff)
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
Diffstat (limited to 'src/pathops/SkDQuadIntersection.cpp')
-rw-r--r--src/pathops/SkDQuadIntersection.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pathops/SkDQuadIntersection.cpp b/src/pathops/SkDQuadIntersection.cpp
index b6a1761781..8b222f725d 100644
--- a/src/pathops/SkDQuadIntersection.cpp
+++ b/src/pathops/SkDQuadIntersection.cpp
@@ -9,7 +9,7 @@
#include "SkIntersections.h"
#include "SkPathOpsLine.h"
#include "SkQuarticRoot.h"
-#include "SkTDArray.h"
+#include "SkTArray.h"
#include "SkTSort.h"
/* given the implicit form 0 = Ax^2 + Bxy + Cy^2 + Dx + Ey + F
@@ -150,9 +150,9 @@ static bool is_linear_inner(const SkDQuad& q1, double t1s, double t1e, const SkD
SkDQuad hull = q1.subDivide(t1s, t1e);
SkDLine line = {{hull[2], hull[0]}};
const SkDLine* testLines[] = { &line, (const SkDLine*) &hull[0], (const SkDLine*) &hull[1] };
- size_t testCount = SK_ARRAY_COUNT(testLines);
- SkTDArray<double> tsFound;
- for (size_t index = 0; index < testCount; ++index) {
+ const size_t kTestCount = SK_ARRAY_COUNT(testLines);
+ SkSTArray<kTestCount * 2, double, true> tsFound;
+ for (size_t index = 0; index < kTestCount; ++index) {
SkIntersections rootTs;
int roots = rootTs.intersect(q2, *testLines[index]);
for (int idx2 = 0; idx2 < roots; ++idx2) {
@@ -165,7 +165,7 @@ static bool is_linear_inner(const SkDQuad& q1, double t1s, double t1e, const SkD
if (approximately_negative(t - t2s) || approximately_positive(t - t2e)) {
continue;
}
- *tsFound.append() = rootTs[0][idx2];
+ tsFound.push_back(rootTs[0][idx2]);
}
}
int tCount = tsFound.count();