fixed 'corners' of paths in GrAAConvexTessellator
BUG=skia:5671
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2280943003
Review-Url: https://codereview.chromium.org/2280943003
diff --git a/src/gpu/batches/GrAAConvexTessellator.h b/src/gpu/batches/GrAAConvexTessellator.h
index faa251e..2683147 100644
--- a/src/gpu/batches/GrAAConvexTessellator.h
+++ b/src/gpu/batches/GrAAConvexTessellator.h
@@ -166,12 +166,24 @@
SkTDArray<PointData> fPts;
};
+ // Represents whether a given point is within a curve. A point is inside a curve only if it is
+ // an interior point within a quad, cubic, or conic, or if it is the endpoint of a quad, cubic,
+ // or conic with another curve meeting it at (more or less) the same angle.
+ enum CurveState {
+ // point is a sharp vertex
+ kSharp_CurveState,
+ // endpoint of a curve with the other side's curvature not yet determined
+ kIndeterminate_CurveState,
+ // point is in the interior of a curve
+ kCurve_CurveState
+ };
+
bool movable(int index) const { return fMovable[index]; }
// 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, SkScalar coverage, bool movable, bool isCurve);
+ int addPt(const SkPoint& pt, SkScalar depth, SkScalar coverage, bool movable, CurveState curve);
void popLastPt();
void popFirstPtShuffle();
@@ -191,9 +203,9 @@
int edgeIdx, SkScalar desiredDepth,
SkPoint* result) const;
- void lineTo(SkPoint p, bool isCurve);
+ void lineTo(SkPoint p, CurveState curve);
- void lineTo(const SkMatrix& m, SkPoint p, bool isCurve);
+ void lineTo(const SkMatrix& m, SkPoint p, CurveState curve);
void quadTo(SkPoint pts[3]);
@@ -226,43 +238,43 @@
void validate() const;
// fPts, fCoverages & fMovable should always have the same # of elements
- SkTDArray<SkPoint> fPts;
- SkTDArray<SkScalar> fCoverages;
+ SkTDArray<SkPoint> fPts;
+ SkTDArray<SkScalar> fCoverages;
// movable points are those that can be slid further along their bisector
- SkTDArray<bool> fMovable;
+ SkTDArray<bool> fMovable;
// The outward facing normals for the original polygon
- SkTDArray<SkVector> fNorms;
+ SkTDArray<SkVector> fNorms;
// 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;
+ SkTDArray<SkVector> fBisectors;
// Tracks whether a given point is interior to a curve. Such points are
// assumed to have shallow curvature.
- SkTDArray<bool> fIsCurve;
+ SkTDArray<CurveState> fCurveState;
- SkPoint::Side fSide; // winding of the original polygon
+ SkPoint::Side fSide; // winding of the original polygon
// The triangulation of the points
- SkTDArray<int> fIndices;
+ SkTDArray<int> fIndices;
- Ring fInitialRing;
+ Ring fInitialRing;
#if GR_AA_CONVEX_TESSELLATOR_VIZ
// When visualizing save all the rings
- SkTDArray<Ring*> fRings;
+ SkTDArray<Ring*> fRings;
#else
- Ring fRings[2];
+ Ring fRings[2];
#endif
- CandidateVerts fCandidateVerts;
+ CandidateVerts fCandidateVerts;
// < 0 means filling rather than stroking
- SkScalar fStrokeWidth;
+ SkScalar fStrokeWidth;
- SkPaint::Join fJoin;
+ SkPaint::Join fJoin;
- SkScalar fMiterLimit;
+ SkScalar fMiterLimit;
- SkTDArray<SkPoint> fPointBuffer;
+ SkTDArray<SkPoint> fPointBuffer;
};