aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar fs <fs@opera.com>2016-01-20 09:51:07 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-01-20 09:51:08 -0800
commitb1475b0d41efc580207183a4e25d14e920b57360 (patch)
treee6902299103f4f324c7cf1aafe95c8a1a9d30c81 /src
parent3425cbaee16aface56eafd3e97aa60071a3fec85 (diff)
Add SkPath::isLastContourClosed()
Adds a simple method for checking if the last command/verb in the current contour is a 'close'. This will simplify determining "closedness" for blink::Path, and aid in the implementation of algorithms such as: https://drafts.fxtf.org/motion-1/#motion-processing (second item in list) GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1601103006 Review URL: https://codereview.chromium.org/1601103006
Diffstat (limited to 'src')
-rw-r--r--src/core/SkPath.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 4af2dad526..4c148c5e4a 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -318,6 +318,14 @@ void SkPath::rewind() {
this->resetFields();
}
+bool SkPath::isLastContourClosed() const {
+ int verbCount = fPathRef->countVerbs();
+ if (0 == verbCount) {
+ return false;
+ }
+ return kClose_Verb == fPathRef->atVerb(verbCount - 1);
+}
+
bool SkPath::isLine(SkPoint line[2]) const {
int verbCount = fPathRef->countVerbs();