aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkEdgeBuilder.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/SkEdgeBuilder.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/SkEdgeBuilder.cpp')
-rw-r--r--src/core/SkEdgeBuilder.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/SkEdgeBuilder.cpp b/src/core/SkEdgeBuilder.cpp
index f1aa105ec8..385193040b 100644
--- a/src/core/SkEdgeBuilder.cpp
+++ b/src/core/SkEdgeBuilder.cpp
@@ -441,3 +441,18 @@ int SkEdgeBuilder::build(const SkPath& path, const SkIRect* iclip, int shiftUp,
fEdgeList = fList.begin();
return fList.count();
}
+
+int SkEdgeBuilder::build_edges(const SkPath& path, const SkIRect* shiftedClip,
+ int shiftEdgesUp, bool pathContainedInClip, bool analyticAA) {
+ // If we're convex, then we need both edges, even the right edge is past the clip
+ const bool canCullToTheRight = !path.isConvex();
+
+ const SkIRect* builderClip = pathContainedInClip ? nullptr : shiftedClip;
+ int count = this->build(path, builderClip, shiftEdgesUp, canCullToTheRight, analyticAA);
+ SkASSERT(count >= 0);
+
+ // canCullToRight == false should imply count != 1
+ SkASSERT(canCullToTheRight || count != 1);
+
+ return count;
+}