diff options
author | bsalomon <bsalomon@google.com> | 2016-06-14 14:37:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-14 14:37:21 -0700 |
commit | fd32df716cfc787a3ac50efb293a9317a97078c5 (patch) | |
tree | e7d7de97ef88ee4d9cc8a526d646eeff245209f5 /src | |
parent | f7fcdb226dc1a2d2929ef26c5ce7cea4460b809c (diff) |
Fix GrShape to preserve inverseness of rrects for strokes but not dashes.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2051263003
Review-Url: https://codereview.chromium.org/2051263003
Diffstat (limited to 'src')
-rw-r--r-- | src/gpu/GrShape.cpp | 14 | ||||
-rw-r--r-- | src/gpu/GrShape.h | 10 |
2 files changed, 10 insertions, 14 deletions
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp index 11b2d38971..7be7e7ad04 100644 --- a/src/gpu/GrShape.cpp +++ b/src/gpu/GrShape.cpp @@ -281,16 +281,16 @@ GrShape::GrShape(const GrShape& parent, GrStyle::Apply apply, SkScalar scale) { static inline bool rrect_path_is_inverse_filled(const SkPath& path, const SkStrokeRec& strokeRec, const SkPathEffect* pe) { - // Dashing doesn't use the path fill type. Dashing only works with stroking + // This is currently imitating the questionable behavior of the sw-rasterizer. Inverseness is + // respected for stroking but not dashing + stroking. (We make no assumptions about arbitrary + // path effects and preserve the path's inverseness.) + // skbug.com/5421 if (pe && pe->asADash(nullptr)) { - pe = nullptr; - } - - SkStrokeRec::Style style = strokeRec.getStyle(); - if (!pe && (SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_Style == style)) { - // stroking ignores the path fill rule. + SkDEBUGCODE(SkStrokeRec::Style style = strokeRec.getStyle();) + SkASSERT(SkStrokeRec::kStroke_Style == style || SkStrokeRec::kHairline_Style == style); return false; } + return path.isInverseFillType(); } diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h index 93896ce3f0..6da1a41acb 100644 --- a/src/gpu/GrShape.h +++ b/src/gpu/GrShape.h @@ -293,13 +293,9 @@ private: SkASSERT(Type::kRRect == fType); SkASSERT(!fInheritedKey.count()); if (fRRectIsInverted) { - if (!fStyle.hasNonDashPathEffect()) { - SkStrokeRec::Style recStyle = fStyle.strokeRec().getStyle(); - if (SkStrokeRec::kStroke_Style == recStyle || - SkStrokeRec::kHairline_Style == recStyle) { - // stroking ignores the path fill rule. - fRRectIsInverted = false; - } + if (fStyle.isDashed()) { + // Dashing ignores the inverseness (currently). skbug.com/5421 + fRRectIsInverted = false; } } else if (fRRect.isEmpty()) { fType = Type::kEmpty; |