int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, SkScalar tol) { if (tol < gMinCurveTol) { tol = gMinCurveTol; } SkASSERT(tol > 0); int pointCount = 0; *subpaths = 1; bool first = true; SkPath::Iter iter(path, false); SkPath::Verb verb; SkPoint pts[4]; while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { switch (verb) { case SkPath::kLine_Verb: pointCount += 1; break; case SkPath::kConic_Verb: { SkScalar weight = iter.conicWeight(); SkAutoConicToQuads converter; const SkPoint* quadPts = converter.computeQuads(pts, weight, 0.25f); for (int i = 0; i < converter.countQuads(); ++i) { pointCount += quadraticPointCount(quadPts + 2*i, tol); } } case SkPath::kQuad_Verb: pointCount += quadraticPointCount(pts, tol); break; case SkPath::kCubic_Verb: pointCount += cubicPointCount(pts, tol); break; case SkPath::kMove_Verb: pointCount += 1; if (!first) { ++(*subpaths); } break; default: break; } first = false; } return pointCount; }
int GrPathUtils::worstCasePointCount(const GrPath& path, int* subpaths, GrScalar tol) { if (tol < gMinCurveTol) { tol == gMinCurveTol; } GrAssert(tol > 0); int pointCount = 0; *subpaths = 1; bool first = true; SkPath::Iter iter(path, false); GrPathCmd cmd; GrPoint pts[4]; while ((cmd = (GrPathCmd)iter.next(pts)) != kEnd_PathCmd) { switch (cmd) { case kLine_PathCmd: pointCount += 1; break; case kQuadratic_PathCmd: pointCount += quadraticPointCount(pts, tol); break; case kCubic_PathCmd: pointCount += cubicPointCount(pts, tol); break; case kMove_PathCmd: pointCount += 1; if (!first) { ++(*subpaths); } break; default: break; } first = false; } return pointCount; }
int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, SkScalar tol) { if (tol < gMinCurveTol) { tol = gMinCurveTol; } SkASSERT(tol > 0); int pointCount = 0; *subpaths = 1; bool first = true; SkPath::Iter iter(path, false); SkPath::Verb verb; SkPoint pts[4]; while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { switch (verb) { case SkPath::kLine_Verb: pointCount += 1; break; case SkPath::kQuad_Verb: pointCount += quadraticPointCount(pts, tol); break; case SkPath::kCubic_Verb: pointCount += cubicPointCount(pts, tol); break; case SkPath::kMove_Verb: pointCount += 1; if (!first) { ++(*subpaths); } break; default: break; } first = false; } return pointCount; }