minor cleanups, in prep for more work on improving precision
git-svn-id: http://skia.googlecode.com/svn/trunk@3993 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index d09bf92..887c0c1 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -51,17 +51,6 @@
return tspan >> 10;
}
-#if 0
-static inline bool tangents_too_curvy(const SkVector& tan0, SkVector& tan1) {
- static const SkScalar kFlatEnoughTangentDotProd = SK_Scalar1 * 99 / 100;
-
- SkASSERT(kFlatEnoughTangentDotProd > 0 &&
- kFlatEnoughTangentDotProd < SK_Scalar1);
-
- return SkPoint::DotProduct(tan0, tan1) < kFlatEnoughTangentDotProd;
-}
-#endif
-
// can't use tangents, since we need [0..1..................2] to be seen
// as definitely not a line (it is when drawn, but not parametrically)
// so we compare midpoints
@@ -259,15 +248,13 @@
#endif
}
-static void compute_pos_tan(const SkTDArray<SkPoint>& segmentPts, int ptIndex,
- int segType, SkScalar t, SkPoint* pos, SkVector* tangent) {
- const SkPoint* pts = &segmentPts[ptIndex];
-
+static void compute_pos_tan(const SkPoint pts[], int segType,
+ SkScalar t, SkPoint* pos, SkVector* tangent) {
switch (segType) {
case kLine_SegType:
if (pos) {
pos->set(SkScalarInterp(pts[0].fX, pts[1].fX, t),
- SkScalarInterp(pts[0].fY, pts[1].fY, t));
+ SkScalarInterp(pts[0].fY, pts[1].fY, t));
}
if (tangent) {
tangent->setNormalize(pts[1].fX - pts[0].fX, pts[1].fY - pts[0].fY);
@@ -290,8 +277,8 @@
}
}
-static void seg_to(const SkTDArray<SkPoint>& segmentPts, int ptIndex,
- int segType, SkScalar startT, SkScalar stopT, SkPath* dst) {
+static void seg_to(const SkPoint pts[], int segType,
+ SkScalar startT, SkScalar stopT, SkPath* dst) {
SkASSERT(startT >= 0 && startT <= SK_Scalar1);
SkASSERT(stopT >= 0 && stopT <= SK_Scalar1);
SkASSERT(startT <= stopT);
@@ -300,7 +287,6 @@
return;
}
- const SkPoint* pts = &segmentPts[ptIndex];
SkPoint tmp0[7], tmp1[7];
switch (segType) {
@@ -462,7 +448,7 @@
SkScalar t;
const Segment* seg = this->distanceToSegment(distance, &t);
- compute_pos_tan(fPts, seg->fPtIndex, seg->fType, t, pos, tangent);
+ compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, t, pos, tangent);
return true;
}
@@ -510,19 +496,19 @@
SkASSERT(seg <= stopSeg);
if (startWithMoveTo) {
- compute_pos_tan(fPts, seg->fPtIndex, seg->fType, startT, &p, NULL);
+ compute_pos_tan(&fPts[seg->fPtIndex], seg->fType, startT, &p, NULL);
dst->moveTo(p);
}
if (seg->fPtIndex == stopSeg->fPtIndex) {
- seg_to(fPts, seg->fPtIndex, seg->fType, startT, stopT, dst);
+ seg_to(&fPts[seg->fPtIndex], seg->fType, startT, stopT, dst);
} else {
do {
- seg_to(fPts, seg->fPtIndex, seg->fType, startT, SK_Scalar1, dst);
+ seg_to(&fPts[seg->fPtIndex], seg->fType, startT, SK_Scalar1, dst);
seg = SkPathMeasure::NextSegment(seg);
startT = 0;
} while (seg->fPtIndex < stopSeg->fPtIndex);
- seg_to(fPts, seg->fPtIndex, seg->fType, 0, stopT, dst);
+ seg_to(&fPts[seg->fPtIndex], seg->fType, 0, stopT, dst);
}
return true;
}