aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-28 11:57:12 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-28 11:57:12 +0000
commit33114e0e59ef1bb9c37297a147d98aa325cabaf9 (patch)
tree3a43c442d3a4b7314e8a603a697ef3ee1f3e07cd
parent3aaf6a0c874d06a3294454e515a9ec3c81bbd8b7 (diff)
remove unused and untested SkPath::subdivide()
git-svn-id: http://skia.googlecode.com/svn/trunk@1732 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/core/SkPath.h6
-rw-r--r--src/core/SkPath.cpp82
2 files changed, 0 insertions, 88 deletions
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 7120d3fa95..35bdb2451f 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -639,12 +639,6 @@ public:
void flatten(SkWriter32&) const;
void unflatten(SkReader32&);
- /** Subdivide the path so that no segment is longer that dist.
- If bendLines is true, then turn all line segments into curves.
- If dst == null, then the original path itself is modified (not const!)
- */
- void subdivide(SkScalar dist, bool bendLines, SkPath* dst = NULL) const;
-
#ifdef ANDROID
uint32_t getGenerationID() const;
#endif
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 99a9e4c55d..b13345093f 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1194,88 +1194,6 @@ SkPath::Verb SkPath::Iter::next(SkPoint pts[4]) {
///////////////////////////////////////////////////////////////////////////////
-static bool exceeds_dist(const SkScalar p[], const SkScalar q[], SkScalar dist,
- int count) {
- SkASSERT(dist > 0);
-
- for (int i = 0; i < count; i++) {
- if (SkScalarAbs(p[i] - q[i]) > dist) {
- return true;
- }
- }
- return false;
-}
-
-static void subdivide_quad(SkPath* dst, const SkPoint pts[3], SkScalar dist,
- int subLevel = 4) {
- if (--subLevel >= 0 && exceeds_dist(&pts[0].fX, &pts[1].fX, dist, 4)) {
- SkPoint tmp[5];
- SkChopQuadAtHalf(pts, tmp);
-
- subdivide_quad(dst, &tmp[0], dist, subLevel);
- subdivide_quad(dst, &tmp[2], dist, subLevel);
- } else {
- dst->quadTo(pts[1], pts[2]);
- }
-}
-
-static void subdivide_cubic(SkPath* dst, const SkPoint pts[4], SkScalar dist,
- int subLevel = 4) {
- if (--subLevel >= 0 && exceeds_dist(&pts[0].fX, &pts[1].fX, dist, 6)) {
- SkPoint tmp[7];
- SkChopCubicAtHalf(pts, tmp);
-
- subdivide_cubic(dst, &tmp[0], dist, subLevel);
- subdivide_cubic(dst, &tmp[3], dist, subLevel);
- } else {
- dst->cubicTo(pts[1], pts[2], pts[3]);
- }
-}
-
-void SkPath::subdivide(SkScalar dist, bool bendLines, SkPath* dst) const {
- SkPath tmpPath;
- if (NULL == dst || this == dst) {
- dst = &tmpPath;
- }
-
- SkPath::Iter iter(*this, false);
- SkPoint pts[4];
-
- for (;;) {
- switch (iter.next(pts)) {
- case SkPath::kMove_Verb:
- dst->moveTo(pts[0]);
- break;
- case SkPath::kLine_Verb:
- if (!bendLines) {
- dst->lineTo(pts[1]);
- break;
- }
- // construct a quad from the line
- pts[2] = pts[1];
- pts[1].set(SkScalarAve(pts[0].fX, pts[2].fX),
- SkScalarAve(pts[0].fY, pts[2].fY));
- // fall through to the quad case
- case SkPath::kQuad_Verb:
- subdivide_quad(dst, pts, dist);
- break;
- case SkPath::kCubic_Verb:
- subdivide_cubic(dst, pts, dist);
- break;
- case SkPath::kClose_Verb:
- dst->close();
- break;
- case SkPath::kDone_Verb:
- goto DONE;
- }
- }
-DONE:
- if (&tmpPath == dst) { // i.e. the dst should be us
- dst->swap(*(SkPath*)this);
- }
-}
-
-///////////////////////////////////////////////////////////////////////
/*
Format in flattened buffer: [ptCount, verbCount, pts[], verbs[]]
*/