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

Unified Diff: src/gpu/GrShape.cpp

Issue 2085913003: Canonicalize path fill types for stroked paths in GrShape. (Closed) Base URL: https://chromium.googlesource.com/skia.git@canonicalize_paths
Patch Set: minor cleanup Created 4 years, 6 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/GrShape.cpp
diff --git a/src/gpu/GrShape.cpp b/src/gpu/GrShape.cpp
index 0fb339555ecf0dc4f6609c012adbbcaf33517f02..93ecd6187a8ebce094ef47c1741286cf85424f1d 100644
--- a/src/gpu/GrShape.cpp
+++ b/src/gpu/GrShape.cpp
@@ -332,27 +332,25 @@ void GrShape::attemptToSimplifyPath() {
fPath.get()->setIsVolatile(true);
}
}
- if (fPath.get()->isConvex()) {
- // There is no distinction between even/odd and non-zero winding count for convex
- // paths.
- if (fPath.get()->isInverseFillType()) {
- fPath.get()->setFillType(SkPath::kInverseEvenOdd_FillType);
- } else {
- fPath.get()->setFillType(SkPath::kEvenOdd_FillType);
- }
- }
- if (this->style().isDashed()) {
- // Dashing ignores inverseness (skbug.com/5421)
- switch (fPath.get()->getFillType()) {
- case SkPath::kWinding_FillType:
- case SkPath::kEvenOdd_FillType:
- break;
- case SkPath::kInverseWinding_FillType:
- fPath.get()->setFillType(SkPath::kWinding_FillType);
- break;
- case SkPath::kInverseEvenOdd_FillType:
- fPath.get()->setFillType(SkPath::kEvenOdd_FillType);
- break;
+ if (!this->style().hasNonDashPathEffect()) {
+ if (this->style().strokeRec().getStyle() == SkStrokeRec::kStroke_Style ||
+ this->style().strokeRec().getStyle() == SkStrokeRec::kHairline_Style) {
+ // Stroke styles don't differentiate between winding and even/odd.
+ // Moreover, dashing ignores inverseness (skbug.com/5421)
robertphillips 2016/06/23 18:47:54 why fStyle here and not style() ?
+ bool inverse = !this->fStyle.isDashed() && fPath.get()->isInverseFillType();
+ if (inverse) {
+ fPath.get()->setFillType(kDefaultPathInverseFillType);
+ } else {
+ fPath.get()->setFillType(kDefaultPathFillType);
+ }
+ } else if (fPath.get()->isConvex()) {
+ // There is no distinction between even/odd and non-zero winding count for convex
+ // paths.
+ if (fPath.get()->isInverseFillType()) {
+ fPath.get()->setFillType(kDefaultPathInverseFillType);
+ } else {
+ fPath.get()->setFillType(kDefaultPathFillType);
+ }
}
}
}
« no previous file with comments | « src/gpu/GrShape.h ('k') | tests/GrShapeTest.cpp » ('j') | tests/GrShapeTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698