diff options
author | ethannicholas <ethannicholas@google.com> | 2015-08-19 12:09:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-19 12:09:12 -0700 |
commit | fea7763140ba74b78f2c30028452e250140b6f21 (patch) | |
tree | 281b8afc1cb82b3828e0815cbf06736bf8c9e0d1 /src | |
parent | e5e6c6069fb808626df0280cebc9399a950cdff7 (diff) |
Fix transformed stroke width in GrAALinearizingConvexPathRenderer.
BUG=520476
Review URL: https://codereview.chromium.org/1302503003
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrAAConvexTessellator.cpp | 11 | ||||
-rw-r--r-- | src/gpu/GrAALinearizingConvexPathRenderer.cpp | 7 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/gpu/GrAAConvexTessellator.cpp b/src/gpu/GrAAConvexTessellator.cpp index e38ba3c3ae..db10086741 100644 --- a/src/gpu/GrAAConvexTessellator.cpp +++ b/src/gpu/GrAAConvexTessellator.cpp @@ -201,10 +201,14 @@ bool GrAAConvexTessellator::tessellate(const SkMatrix& m, const SkPath& path) { } SkScalar coverage = 1.0f; + SkScalar scaleFactor = 0.0f; if (fStrokeWidth >= 0.0f) { + SkASSERT(m.isSimilarity()); + scaleFactor = m.getMaxScale(); // x and y scale are the same + SkScalar effectiveStrokeWidth = scaleFactor * fStrokeWidth; Ring outerStrokeRing; - this->createOuterRing(fInitialRing, fStrokeWidth / 2 - kAntialiasingRadius, coverage, - &outerStrokeRing); + this->createOuterRing(fInitialRing, effectiveStrokeWidth / 2 - kAntialiasingRadius, + coverage, &outerStrokeRing); outerStrokeRing.init(*this); Ring outerAARing; this->createOuterRing(outerStrokeRing, kAntialiasingRadius * 2, 0.0f, &outerAARing); @@ -216,8 +220,9 @@ bool GrAAConvexTessellator::tessellate(const SkMatrix& m, const SkPath& path) { // the bisectors are only needed for the computation of the outer ring fBisectors.rewind(); if (fStrokeWidth >= 0.0f && fInitialRing.numPts() > 2) { + SkScalar effectiveStrokeWidth = scaleFactor * fStrokeWidth; Ring* insetStrokeRing; - SkScalar strokeDepth = fStrokeWidth / 2 - kAntialiasingRadius; + SkScalar strokeDepth = effectiveStrokeWidth / 2 - kAntialiasingRadius; if (this->createInsetRings(fInitialRing, 0.0f, coverage, strokeDepth, coverage, &insetStrokeRing)) { Ring* insetAARing; diff --git a/src/gpu/GrAALinearizingConvexPathRenderer.cpp b/src/gpu/GrAALinearizingConvexPathRenderer.cpp index fc72a8f60f..899c6b1ef1 100644 --- a/src/gpu/GrAALinearizingConvexPathRenderer.cpp +++ b/src/gpu/GrAALinearizingConvexPathRenderer.cpp @@ -50,8 +50,11 @@ bool GrAALinearizingConvexPathRenderer::onCanDrawPath(const CanDrawPathArgs& arg return false; } if (args.fStroke->getStyle() == SkStrokeRec::kStroke_Style) { - return args.fViewMatrix->isSimilarity() && args.fStroke->getWidth() >= 1.0f && - args.fStroke->getWidth() <= kMaxStrokeWidth && !args.fStroke->isDashed() && + if (!args.fViewMatrix->isSimilarity()) { + return false; + } + SkScalar strokeWidth = args.fViewMatrix->getMaxScale() * args.fStroke->getWidth(); + return strokeWidth >= 1.0f && strokeWidth <= kMaxStrokeWidth && !args.fStroke->isDashed() && SkPathPriv::LastVerbIsClose(*args.fPath) && args.fStroke->getJoin() != SkPaint::Join::kRound_Join; } |