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

Unified Diff: src/gpu/GrTessellator.cpp

Issue 2404403003: GrTessellator: make inverse fill types more sane. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTessellator.cpp
diff --git a/src/gpu/GrTessellator.cpp b/src/gpu/GrTessellator.cpp
index 4024ad0c16d2138b0d4b1476d411d135fec0b206..c0a2d1cfddc7e62636c956d89591efc5f669c396 100644
--- a/src/gpu/GrTessellator.cpp
+++ b/src/gpu/GrTessellator.cpp
@@ -676,7 +676,7 @@ void path_to_contours(const SkPath& path, SkScalar tolerance, const SkRect& clip
if (path.isInverseFillType()) {
SkPoint quad[4];
clipBounds.toQuad(quad);
- for (int i = 0; i < 4; i++) {
+ for (int i = 3; i >= 0; i--) {
prev = append_point_to_contour(quad[i], prev, &head, alloc);
}
head->fPrev = prev;
@@ -758,7 +758,7 @@ inline bool apply_fill_type(SkPath::FillType fillType, Poly* poly) {
case SkPath::kEvenOdd_FillType:
return (winding & 1) != 0;
case SkPath::kInverseWinding_FillType:
- return winding == -1;
+ return winding == 1;
case SkPath::kInverseEvenOdd_FillType:
return (winding & 1) == 1;
default:
@@ -1637,8 +1637,7 @@ Vertex* contours_to_mesh(Vertex** contours, int contourCnt, bool antialias,
return build_edges(contours, contourCnt, c, alloc);
}
-Poly* mesh_to_polys(Vertex** vertices, SkPath::FillType fillType, Comparator& c,
- SkChunkAlloc& alloc) {
+Poly* mesh_to_polys(Vertex** vertices, Comparator& c, SkChunkAlloc& alloc) {
if (!vertices || !*vertices) {
return nullptr;
}
@@ -1668,7 +1667,7 @@ Poly* contours_to_polys(Vertex** contours, int contourCnt, SkPath::FillType fill
c.sweep_gt = sweep_gt_vert;
}
Vertex* mesh = contours_to_mesh(contours, contourCnt, antialias, c, alloc);
- Poly* polys = mesh_to_polys(&mesh, fillType, c, alloc);
+ Poly* polys = mesh_to_polys(&mesh, c, alloc);
if (antialias) {
EdgeList* boundaries = extract_boundaries(mesh, fillType, alloc);
VertexList aaMesh;
@@ -1678,7 +1677,7 @@ Poly* contours_to_polys(Vertex** contours, int contourCnt, SkPath::FillType fill
boundary_to_aa_mesh(boundary, &aaMesh, c, alloc);
}
}
- return mesh_to_polys(&aaMesh.fHead, SkPath::kWinding_FillType, c, alloc);
+ return mesh_to_polys(&aaMesh.fHead, c, alloc);
}
return polys;
}
@@ -1755,7 +1754,7 @@ int PathToTriangles(const SkPath& path, SkScalar tolerance, const SkRect& clipBo
SkChunkAlloc alloc(sizeEstimate);
Poly* polys = path_to_polys(path, tolerance, clipBounds, contourCnt, alloc, antialias,
isLinear);
- SkPath::FillType fillType = path.getFillType();
+ SkPath::FillType fillType = antialias ? SkPath::kWinding_FillType : path.getFillType();
int count = count_points(polys, fillType);
if (0 == count) {
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698