aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkScan_Path.cpp
diff options
context:
space:
mode:
authorGravatar Yuqian Li <liyuqian@google.com>2017-05-26 14:50:35 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-05-26 19:14:51 +0000
commit1c8408847cc626a34fc885b1c6313533d030e192 (patch)
treef10803c94307dae7835b008b59abe3fd19a9540a /src/core/SkScan_Path.cpp
parenta132c3869fcffb350d7a5ca7256496ab977bdd0c (diff)
Explicitly check edge count >= 2 in non-debug build
We also preserve the check in debug mode that the count should never be 1 when the path is convex. Bug: skia:6684 Change-Id: I4d4c9ad9f9d704e94bbe51f10a96f8b3066afaa1 Reviewed-on: https://skia-review.googlesource.com/17983 Commit-Queue: Yuqian Li <liyuqian@google.com> Reviewed-by: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkScan_Path.cpp')
-rw-r--r--src/core/SkScan_Path.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/core/SkScan_Path.cpp b/src/core/SkScan_Path.cpp
index 0415b2f99a..0975af8ddc 100644
--- a/src/core/SkScan_Path.cpp
+++ b/src/core/SkScan_Path.cpp
@@ -396,16 +396,9 @@ void sk_fill_path(const SkPath& path, const SkIRect& clipRect, SkBlitter* blitte
shiftedClip.fTop <<= shiftEdgesUp;
shiftedClip.fBottom <<= shiftEdgesUp;
- SkEdgeBuilder builder;
-
- // If we're convex, then we need both edges, even the right edge is past the clip
- const bool canCullToTheRight = !path.isConvex();
-
- SkIRect* builderClip = pathContainedInClip ? nullptr : &shiftedClip;
- int count = builder.build(path, builderClip, shiftEdgesUp, canCullToTheRight);
- SkASSERT(count >= 0);
-
- SkEdge** list = builder.edgeList();
+ SkEdgeBuilder builder;
+ int count = builder.build_edges(path, &shiftedClip, shiftEdgesUp, pathContainedInClip);
+ SkEdge** list = builder.edgeList();
if (0 == count) {
if (path.isInverseFillType()) {
@@ -467,8 +460,8 @@ void sk_fill_path(const SkPath& path, const SkIRect& clipRect, SkBlitter* blitte
proc = PrePostInverseBlitterProc;
}
- if (path.isConvex() && (nullptr == proc)) {
- SkASSERT(count >= 2); // convex walker does not handle missing right edges
+ // count >= 2 is required as the convex walker does not handle missing right edges
+ if (path.isConvex() && (nullptr == proc) && count >= 2) {
walk_convex_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, nullptr);
} else {
walk_edges(&headEdge, path.getFillType(), blitter, start_y, stop_y, proc,