Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Unified Diff: src/gpu/GrAAConvexTessellator.cpp

Issue 1302503003: Fix transformed stroke width in GrAALinearizingConvexPathRenderer. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: added an assert Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrAAConvexTessellator.cpp
diff --git a/src/gpu/GrAAConvexTessellator.cpp b/src/gpu/GrAAConvexTessellator.cpp
index e38ba3c3aed8c96a63ab83f70abb55c192e6ea79..2d22f6aa200ebb2b11ea121eba4b78909ccbdd8b 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;
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;

Powered by Google App Engine
This is Rietveld 408576698