Index: src/gpu/GrAAConvexTessellator.h |
diff --git a/src/gpu/GrAAConvexTessellator.h b/src/gpu/GrAAConvexTessellator.h |
index 93e8d4ba61716507b1d6b1febde241bcd1ae3709..b716a44655ecd688361b62c3ec76e3087dcd1983 100644 |
--- a/src/gpu/GrAAConvexTessellator.h |
+++ b/src/gpu/GrAAConvexTessellator.h |
@@ -9,6 +9,7 @@ |
#define GrAAConvexTessellator_DEFINED |
#include "SkColor.h" |
+#include "SkPaint.h" |
#include "SkPoint.h" |
#include "SkScalar.h" |
#include "SkTDArray.h" |
@@ -19,6 +20,8 @@ class SkPath; |
//#define GR_AA_CONVEX_TESSELLATOR_VIZ 1 |
robertphillips
2015/06/16 13:13:02
// Add a comment ?
ethannicholas
2015/06/16 14:53:29
Done.
|
+static const SkScalar kAntialiasingRadius = 0.5f; |
+ |
class GrAAConvexTessellator; |
// The AAConvexTessellator holds the global pool of points and the triangulation |
@@ -27,14 +30,15 @@ class GrAAConvexTessellator; |
// computeDepthFromEdge requests. |
class GrAAConvexTessellator { |
public: |
- GrAAConvexTessellator(SkScalar targetDepth = 0.5f) |
+ GrAAConvexTessellator(SkScalar strokeWidth = -1.0f, |
+ SkPaint::Join join = SkPaint::Join::kBevel_Join, |
+ SkScalar miterLimit = 0.0f) |
: fSide(SkPoint::kOn_Side) |
- , fTargetDepth(targetDepth) { |
+ , fStrokeWidth(strokeWidth) |
+ , fJoin(join) |
+ , fMiterLimit(miterLimit) { |
} |
- void setTargetDepth(SkScalar targetDepth) { fTargetDepth = targetDepth; } |
- SkScalar targetDepth() const { return fTargetDepth; } |
- |
SkPoint::Side side() const { return fSide; } |
bool tessellate(const SkMatrix& m, const SkPath& path); |
@@ -46,7 +50,7 @@ public: |
const SkPoint& lastPoint() const { return fPts.top(); } |
const SkPoint& point(int index) const { return fPts[index]; } |
int index(int index) const { return fIndices[index]; } |
- SkScalar depth(int index) const {return fDepths[index]; } |
+ SkScalar coverage(int index) const { return fCoverages[index]; } |
#if GR_AA_CONVEX_TESSELLATOR_VIZ |
void draw(SkCanvas* canvas) const; |
@@ -139,6 +143,7 @@ private: |
const SkPoint& bisector(int index) const { return fPts[index].fBisector; } |
int index(int index) const { return fPts[index].fIndex; } |
int origEdgeID(int index) const { return fPts[index].fOrigEdgeId; } |
+ void setOrigEdgeId(int index, int id) { fPts[index].fOrigEdgeId = id; } |
#if GR_AA_CONVEX_TESSELLATOR_VIZ |
void draw(SkCanvas* canvas, const GrAAConvexTessellator& tess) const; |
@@ -165,17 +170,17 @@ private: |
// 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, bool isCurve); |
+ int addPt(const SkPoint& pt, SkScalar depth, SkScalar coverage, bool movable, bool isCurve); |
void popLastPt(); |
void popFirstPtShuffle(); |
- void updatePt(int index, const SkPoint& pt, SkScalar depth); |
+ void updatePt(int index, const SkPoint& pt, SkScalar depth, SkScalar coverage); |
void addTri(int i0, int i1, int i2); |
void reservePts(int count) { |
fPts.setReserve(count); |
- fDepths.setReserve(count); |
+ fCoverages.setReserve(count); |
fMovable.setReserve(count); |
} |
@@ -200,11 +205,18 @@ private: |
void computeBisectors(); |
void fanRing(const Ring& ring); |
- void createOuterRing(); |
Ring* getNextRing(Ring* lastRing); |
- bool createInsetRing(const Ring& lastRing, Ring* nextRing); |
+ void createOuterRing(const Ring& previousRing, SkScalar outset, SkScalar coverage, |
+ Ring* nextRing); |
+ |
+ bool createInsetRings(Ring& previousRing, SkScalar initialDepth, SkScalar initialCoverage, |
robertphillips
2015/06/16 13:13:02
tab this line over ?
|
+ SkScalar targetDepth, SkScalar targetCoverage, Ring** finalRing); |
+ |
+ bool createInsetRing(const Ring& lastRing, Ring* nextRing, |
+ SkScalar initialDepth, SkScalar initialCoverage, SkScalar targetDepth, |
+ SkScalar targetCoverage, bool forceNew); |
void validate() const; |
@@ -214,9 +226,9 @@ private: |
void checkAllDepths() const; |
#endif |
- // fPts, fWeights & fMovable should always have the same # of elements |
+ // fPts, fCoverages & fMovable should always have the same # of elements |
SkTDArray<SkPoint> fPts; |
- SkTDArray<SkScalar> fDepths; |
+ SkTDArray<SkScalar> fCoverages; |
// movable points are those that can be slid further along their bisector |
SkTDArray<bool> fMovable; |
@@ -244,18 +256,14 @@ private: |
#endif |
CandidateVerts fCandidateVerts; |
- SkScalar fTargetDepth; |
+ // < 0 means filling rather than stroking |
+ SkScalar fStrokeWidth; |
- SkTDArray<SkPoint> fPointBuffer; |
+ SkPaint::Join fJoin; |
- // 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;) |
+ SkScalar fMiterLimit; |
- SkDEBUGCODE(SkScalar fMinCross;) |
- |
- SkDEBUGCODE(SkScalar fMaxCross;) |
+ SkTDArray<SkPoint> fPointBuffer; |
}; |