aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathPriv.h
diff options
context:
space:
mode:
authorGravatar ethannicholas <ethannicholas@google.com>2015-12-15 11:01:12 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-12-15 11:01:12 -0800
commitc88cb8942e9b0097784d048dc2734b9e0d4391d1 (patch)
treee29a76c1a835c64770b009413d8f8bce63e6856c /src/core/SkPathPriv.h
parentdb284c52e62e8d16708e2065495a3b693b238771 (diff)
Fix for GrAALinearizingConvexPathRenderer incorrectly drawing non-convex paths
Diffstat (limited to 'src/core/SkPathPriv.h')
-rw-r--r--src/core/SkPathPriv.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/core/SkPathPriv.h b/src/core/SkPathPriv.h
index 51a1a80094..048c926ce2 100644
--- a/src/core/SkPathPriv.h
+++ b/src/core/SkPathPriv.h
@@ -55,9 +55,29 @@ public:
return computedDir == dir;
}
- static bool LastVerbIsClose(const SkPath& path) {
- int count = path.countVerbs();
- return count >= 1 && path.fPathRef->verbs()[~(count - 1)] == SkPath::Verb::kClose_Verb;
+ static bool IsClosedSingleContour(const SkPath& path) {
+ int verbCount = path.countVerbs();
+ if (verbCount == 0)
+ return false;
+ int moveCount = 0;
+ auto verbs = path.fPathRef->verbs();
+ for (int i = 0; i < verbCount; i++) {
+ switch (verbs[~i]) { // verbs are stored backwards; we use [~i] to get the i'th verb
+ case SkPath::Verb::kMove_Verb:
+ moveCount += 1;
+ if (moveCount > 1) {
+ return false;
+ }
+ break;
+ case SkPath::Verb::kClose_Verb:
+ if (i == verbCount - 1) {
+ return true;
+ }
+ return false;
+ default: break;
+ }
+ }
+ return false;
}
static void AddGenIDChangeListener(const SkPath& path, SkPathRef::GenIDChangeListener* listener) {