diff options
author | 2016-09-22 12:42:30 -0700 | |
---|---|---|
committer | 2016-09-22 12:42:30 -0700 | |
commit | 8c170971f182d47bc9af71fc88a607740d03dfd5 (patch) | |
tree | 2ef518201485de4d97fcd9531ab845bd47f88a47 /src/gpu/batches/GrAAConvexTessellator.h | |
parent | e2e87f3484e5524dbfd6c01f402136738d1d434b (diff) |
Make AALinearizingConvexPathRenderer able to handle stroke and fill
This is intended to catch stroke-and-fill convex paths with potentially small stroke widths (e.g., .1).
It does have the disconcerting side effect of changing bevel-joined stroke-and-filled degenerate-single-line-rects into plain rects (w/o triangular end-caps).
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2301353004
Committed: https://skia.googlesource.com/skia/+/522bcd99fa65a8abd130880f59b500cf367d0845
Review-Url: https://codereview.chromium.org/2301353004
Diffstat (limited to 'src/gpu/batches/GrAAConvexTessellator.h')
-rw-r--r-- | src/gpu/batches/GrAAConvexTessellator.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gpu/batches/GrAAConvexTessellator.h b/src/gpu/batches/GrAAConvexTessellator.h index 2683147912..4ba3a9c78b 100644 --- a/src/gpu/batches/GrAAConvexTessellator.h +++ b/src/gpu/batches/GrAAConvexTessellator.h @@ -12,6 +12,7 @@ #include "SkPaint.h" #include "SkPoint.h" #include "SkScalar.h" +#include "SkStrokeRec.h" #include "SkTDArray.h" class SkCanvas; @@ -31,11 +32,13 @@ class GrAAConvexTessellator; // computeDepthFromEdge requests. class GrAAConvexTessellator { public: - GrAAConvexTessellator(SkScalar strokeWidth = -1.0f, + GrAAConvexTessellator(SkStrokeRec::Style style = SkStrokeRec::kFill_Style, + SkScalar strokeWidth = -1.0f, SkPaint::Join join = SkPaint::Join::kBevel_Join, SkScalar miterLimit = 0.0f) : fSide(SkPoint::kOn_Side) , fStrokeWidth(strokeWidth) + , fStyle(style) , fJoin(join) , fMiterLimit(miterLimit) { } @@ -136,6 +139,13 @@ private: pt->fOrigEdgeId = origEdgeId; } + // Upgrade this ring so that it can behave like an originating ring + void makeOriginalRing() { + for (int i = 0; i < fPts.count(); ++i) { + fPts[i].fOrigEdgeId = fPts[i].fIndex; + } + } + // init should be called after all the indices have been added (via addIdx) void init(const GrAAConvexTessellator& tess); void init(const SkTDArray<SkVector>& norms, const SkTDArray<SkVector>& bisectors); @@ -267,8 +277,9 @@ private: #endif CandidateVerts fCandidateVerts; - // < 0 means filling rather than stroking + // the stroke width is only used for stroke or stroke-and-fill styles SkScalar fStrokeWidth; + SkStrokeRec::Style fStyle; SkPaint::Join fJoin; |