return 0 == fPathRef->countVerbs();
}
+ /** Return true if the last contour of this path ends with a close verb.
+ */
+ bool isLastContourClosed() const;
+
/**
* Returns true if all of the points in this path are finite, meaning there
* are no infinities and no NaNs.
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();
test_path_isfinite(reporter);
}
+static void test_islastcontourclosed(skiatest::Reporter* reporter) {
+ SkPath path;
+ REPORTER_ASSERT(reporter, !path.isLastContourClosed());
+ path.moveTo(0, 0);
+ REPORTER_ASSERT(reporter, !path.isLastContourClosed());
+ path.close();
+ REPORTER_ASSERT(reporter, path.isLastContourClosed());
+ path.lineTo(100, 100);
+ REPORTER_ASSERT(reporter, !path.isLastContourClosed());
+ path.moveTo(200, 200);
+ REPORTER_ASSERT(reporter, !path.isLastContourClosed());
+ path.close();
+ REPORTER_ASSERT(reporter, path.isLastContourClosed());
+ path.moveTo(0, 0);
+ REPORTER_ASSERT(reporter, !path.isLastContourClosed());
+}
+
// assert that we always
// start with a moveTo
// only have 1 moveTo
test_addPoly(reporter);
test_isfinite(reporter);
test_isfinite_after_transform(reporter);
+ test_islastcontourclosed(reporter);
test_arb_round_rect_is_convex(reporter);
test_arb_zero_rad_round_rect_is_rect(reporter);
test_addrect(reporter);