Added GrAAFlatteningConvexPathRenderer.
This is an alternate version of GrAAConvexPathRenderer which handles
curves by first flattening them to straight lines.
BUG=skia:
Review URL: https://codereview.chromium.org/1158803002
diff --git a/src/gpu/GrAAConvexTessellator.h b/src/gpu/GrAAConvexTessellator.h
index 707995f..93e8d4b 100644
--- a/src/gpu/GrAAConvexTessellator.h
+++ b/src/gpu/GrAAConvexTessellator.h
@@ -165,7 +165,7 @@
// Movable points are those that can be slid along their bisector.
// Basically, a point is immovable if it is part of the original
// polygon or it results from the fusing of two bisectors.
- int addPt(const SkPoint& pt, SkScalar depth, bool movable);
+ int addPt(const SkPoint& pt, SkScalar depth, bool movable, bool isCurve);
void popLastPt();
void popFirstPtShuffle();
@@ -185,6 +185,14 @@
int edgeIdx, SkScalar desiredDepth,
SkPoint* result) const;
+ void lineTo(const SkMatrix& m, SkPoint p, bool isCurve);
+
+ void quadTo(const SkMatrix& m, SkPoint pts[3]);
+
+ void cubicTo(const SkMatrix& m, SkPoint pts[4]);
+
+ void conicTo(const SkMatrix& m, SkPoint pts[3], SkScalar w);
+
void terminate(const Ring& lastRing);
// return false on failure/degenerate path
@@ -217,6 +225,11 @@
// The inward facing bisector at each point in the original polygon. Only
// needed for exterior ring creation and then handed off to the initial ring.
SkTDArray<SkVector> fBisectors;
+
+ // Tracks whether a given point is interior to a curve. Such points are
+ // assumed to have shallow curvature.
+ SkTDArray<bool> fIsCurve;
+
SkPoint::Side fSide; // winding of the original polygon
// The triangulation of the points
@@ -233,10 +246,16 @@
SkScalar fTargetDepth;
+ SkTDArray<SkPoint> fPointBuffer;
+
// If some goes wrong with the inset computation the tessellator will
// truncate the creation of the inset polygon. In this case the depth
// check will complain.
SkDEBUGCODE(bool fShouldCheckDepths;)
+
+ SkDEBUGCODE(SkScalar fMinCross;)
+
+ SkDEBUGCODE(SkScalar fMaxCross;)
};