Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1056)

Unified Diff: src/gpu/GrPathUtils.cpp

Issue 1694403003: Modify interface to GrPathUtils::convertCubicToQuads (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: whitespace Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrPathUtils.h ('k') | src/gpu/batches/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPathUtils.cpp
diff --git a/src/gpu/GrPathUtils.cpp b/src/gpu/GrPathUtils.cpp
index f97a61e1f60f202942d94ea913b4e98a50b48bf0..0fd8b0e8829a0032361205bb6397fb9cc79b06ae 100644
--- a/src/gpu/GrPathUtils.cpp
+++ b/src/gpu/GrPathUtils.cpp
@@ -545,21 +545,33 @@ void convert_noninflect_cubic_to_quads(const SkPoint p[4],
void GrPathUtils::convertCubicToQuads(const SkPoint p[4],
SkScalar tolScale,
- bool constrainWithinTangents,
- SkPathPriv::FirstDirection dir,
SkTArray<SkPoint, true>* quads) {
SkPoint chopped[10];
int count = SkChopCubicAtInflections(p, chopped);
- // base tolerance is 1 pixel.
- static const SkScalar kTolerance = SK_Scalar1;
- const SkScalar tolSqd = SkScalarSquare(SkScalarMul(tolScale, kTolerance));
+ const SkScalar tolSqd = SkScalarSquare(tolScale);
for (int i = 0; i < count; ++i) {
SkPoint* cubic = chopped + 3*i;
- convert_noninflect_cubic_to_quads(cubic, tolSqd, constrainWithinTangents, dir, quads);
+ // The direction param is ignored if the third param is false.
+ convert_noninflect_cubic_to_quads(cubic, tolSqd, false,
+ SkPathPriv::kCCW_FirstDirection, quads);
}
+}
+
+void GrPathUtils::convertCubicToQuadsConstrainToTangents(const SkPoint p[4],
+ SkScalar tolScale,
+ SkPathPriv::FirstDirection dir,
+ SkTArray<SkPoint, true>* quads) {
+ SkPoint chopped[10];
+ int count = SkChopCubicAtInflections(p, chopped);
+ const SkScalar tolSqd = SkScalarSquare(tolScale);
+
+ for (int i = 0; i < count; ++i) {
+ SkPoint* cubic = chopped + 3*i;
+ convert_noninflect_cubic_to_quads(cubic, tolSqd, true, dir, quads);
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrPathUtils.h ('k') | src/gpu/batches/GrAAConvexPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698