diff options
author | reed <reed@chromium.org> | 2015-06-26 05:06:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-26 05:06:43 -0700 |
commit | 9730f4a663534009d216c2f6d834bd534dd44a3d (patch) | |
tree | 17cb01d25653d1695a4ca35f309c9ebff8cef968 /src/gpu/GrAAConvexTessellator.h | |
parent | f9ad558943ee14bdff824ebfb33988bece8ed3db (diff) |
Revert of added stroking support to GrAALinearizingConvexPathRenderer (patchset #6 id:100001 of https://codereview.chromium.org/1180903006/)
Reason for revert:
speculative revert to try to fix DEPS roll (layouttests)
Original issue's description:
> added stroking support to GrAALinearizingConvexPathRenderer
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/2436f191e6602953b32a51cf50f2d7a4e2af90fd
TBR=bsalomon@google.com,robertphillips@google.com,ethannicholas@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1212833002
Diffstat (limited to 'src/gpu/GrAAConvexTessellator.h')
-rw-r--r-- | src/gpu/GrAAConvexTessellator.h | 61 |
1 files changed, 27 insertions, 34 deletions
diff --git a/src/gpu/GrAAConvexTessellator.h b/src/gpu/GrAAConvexTessellator.h index f3d84dc8ad..93e8d4ba61 100644 --- a/src/gpu/GrAAConvexTessellator.h +++ b/src/gpu/GrAAConvexTessellator.h @@ -9,7 +9,6 @@ #define GrAAConvexTessellator_DEFINED #include "SkColor.h" -#include "SkPaint.h" #include "SkPoint.h" #include "SkScalar.h" #include "SkTDArray.h" @@ -20,9 +19,6 @@ class SkPath; //#define GR_AA_CONVEX_TESSELLATOR_VIZ 1 -// device space distance which we inset / outset points in order to create the soft antialiased edge -static const SkScalar kAntialiasingRadius = 0.5f; - class GrAAConvexTessellator; // The AAConvexTessellator holds the global pool of points and the triangulation @@ -31,15 +27,14 @@ class GrAAConvexTessellator; // computeDepthFromEdge requests. class GrAAConvexTessellator { public: - GrAAConvexTessellator(SkScalar strokeWidth = -1.0f, - SkPaint::Join join = SkPaint::Join::kBevel_Join, - SkScalar miterLimit = 0.0f) + GrAAConvexTessellator(SkScalar targetDepth = 0.5f) : fSide(SkPoint::kOn_Side) - , fStrokeWidth(strokeWidth) - , fJoin(join) - , fMiterLimit(miterLimit) { + , fTargetDepth(targetDepth) { } + 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); @@ -51,7 +46,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 coverage(int index) const { return fCoverages[index]; } + SkScalar depth(int index) const {return fDepths[index]; } #if GR_AA_CONVEX_TESSELLATOR_VIZ void draw(SkCanvas* canvas) const; @@ -144,7 +139,6 @@ 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; @@ -171,17 +165,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, SkScalar coverage, bool movable, bool isCurve); + int addPt(const SkPoint& pt, SkScalar depth, bool movable, bool isCurve); void popLastPt(); void popFirstPtShuffle(); - void updatePt(int index, const SkPoint& pt, SkScalar depth, SkScalar coverage); + void updatePt(int index, const SkPoint& pt, SkScalar depth); void addTri(int i0, int i1, int i2); void reservePts(int count) { fPts.setReserve(count); - fCoverages.setReserve(count); + fDepths.setReserve(count); fMovable.setReserve(count); } @@ -191,12 +185,8 @@ private: int edgeIdx, SkScalar desiredDepth, SkPoint* result) const; - void lineTo(SkPoint p, bool isCurve); - void lineTo(const SkMatrix& m, SkPoint p, bool isCurve); - void quadTo(SkPoint pts[3]); - void quadTo(const SkMatrix& m, SkPoint pts[3]); void cubicTo(const SkMatrix& m, SkPoint pts[4]); @@ -210,24 +200,23 @@ private: void computeBisectors(); void fanRing(const Ring& ring); + void createOuterRing(); Ring* getNextRing(Ring* lastRing); - void createOuterRing(const Ring& previousRing, SkScalar outset, SkScalar coverage, - Ring* nextRing); + bool createInsetRing(const Ring& lastRing, Ring* nextRing); - bool createInsetRings(Ring& previousRing, SkScalar initialDepth, SkScalar initialCoverage, - SkScalar targetDepth, SkScalar targetCoverage, Ring** finalRing); + void validate() const; - bool createInsetRing(const Ring& lastRing, Ring* nextRing, - SkScalar initialDepth, SkScalar initialCoverage, SkScalar targetDepth, - SkScalar targetCoverage, bool forceNew); - void validate() const; +#ifdef SK_DEBUG + SkScalar computeRealDepth(const SkPoint& p) const; + void checkAllDepths() const; +#endif - // fPts, fCoverages & fMovable should always have the same # of elements + // fPts, fWeights & fMovable should always have the same # of elements SkTDArray<SkPoint> fPts; - SkTDArray<SkScalar> fCoverages; + SkTDArray<SkScalar> fDepths; // movable points are those that can be slid further along their bisector SkTDArray<bool> fMovable; @@ -255,14 +244,18 @@ private: #endif CandidateVerts fCandidateVerts; - // < 0 means filling rather than stroking - SkScalar fStrokeWidth; + SkScalar fTargetDepth; - SkPaint::Join fJoin; + SkTDArray<SkPoint> fPointBuffer; - SkScalar fMiterLimit; + // 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;) - SkTDArray<SkPoint> fPointBuffer; + SkDEBUGCODE(SkScalar fMinCross;) + + SkDEBUGCODE(SkScalar fMaxCross;) }; |