aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathUtils.h
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-10 19:53:34 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-10 19:53:34 +0000
commita51ab8416db9772a2eae3122f4f69801642daeb5 (patch)
tree6e11032a744e48cbeb29009d1c26a1840bc50e1a /src/gpu/GrPathUtils.h
parente2589aeebf321f6d3b5005c19740beacee964be7 (diff)
Preserve convex control point polygon in cubic->quadratic approximation
GM test modified, will require rebaselining. Review URL: http://codereview.appspot.com/6355088/ git-svn-id: http://skia.googlecode.com/svn/trunk@4518 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrPathUtils.h')
-rw-r--r--src/gpu/GrPathUtils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gpu/GrPathUtils.h b/src/gpu/GrPathUtils.h
index a1d0eb630b..31b639864e 100644
--- a/src/gpu/GrPathUtils.h
+++ b/src/gpu/GrPathUtils.h
@@ -96,12 +96,23 @@ namespace GrPathUtils {
float fM[6];
};
+
// Converts a cubic into a sequence of quads. If working in device space
// use tolScale = 1, otherwise set based on stretchiness of the matrix. The
// result is sets of 3 points in quads (TODO: share endpoints in returned
// array)
+ // When we approximate a cubic {a,b,c,d} with a quadratic we may have to
+ // ensure that the new control point lies between the lines ab and cd. The
+ // convex path renderer requires this. It starts with a path where all the
+ // control points taken together form a convex polygon. It relies on this
+ // property and the quadratic approximation of cubics step cannot alter it.
+ // Setting constrainWithinTangents to true enforces this property. When this
+ // is true the cubic must be simple and dir must specify the orientation of
+ // the cubic. Otherwise, dir is ignored.
void convertCubicToQuads(const GrPoint p[4],
SkScalar tolScale,
+ bool constrainWithinTangents,
+ SkPath::Direction dir,
SkTArray<SkPoint, true>* quads);
};
#endif