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

Unified Diff: src/core/SkScan_Path.cpp

Issue 913503002: cull edges that are to the right of the clip (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « src/core/SkLineClipper.cpp ('k') | tests/ClipperTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkScan_Path.cpp
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 430cd1d8413b27d9f48bf09734adb8cf79578db4..a7137083654319f6114e4f859da3e672706252e2 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -433,12 +433,14 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
SkEdgeBuilder builder;
// If we're convex, then we need both edges, even the right edge is past the clip
- const bool cullToTheRight = !path.isConvex();
+ const bool canCullToTheRight = !path.isConvex();
+
+ int count = builder.build(path, clipRect, shiftEdgesUp, canCullToTheRight);
+ SkASSERT(count >= 0);
- int count = builder.build(path, clipRect, shiftEdgesUp, cullToTheRight);
SkEdge** list = builder.edgeList();
- if (count < 2) {
+ if (0 == count) {
caryclark 2015/02/09 16:06:30 I don't mind this pattern -- but is it preferable
if (path.isInverseFillType()) {
/*
* Since we are in inverse-fill, our caller has already drawn above
@@ -460,7 +462,6 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
rect.height() << shiftEdgesUp);
}
}
-
return;
}
@@ -500,6 +501,7 @@ void sk_fill_path(const SkPath& path, const SkIRect* clipRect, SkBlitter* blitte
}
if (path.isConvex() && (NULL == proc)) {
+ SkASSERT(count >= 2); // convex walker does not handle missing right edges
walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, NULL);
} else {
int rightEdge;
« no previous file with comments | « src/core/SkLineClipper.cpp ('k') | tests/ClipperTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698