aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/GrShapeTest.cpp
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2016-06-21 08:35:49 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-21 08:35:49 -0700
commit93f66bc3af522fdd2a5315407ba6d3f65c13fd1c (patch)
treeca7007a7ab08f6c7f263c4c734132432fb88024c /tests/GrShapeTest.cpp
parent9b972c4a1278c16d7237563560710774edb43b3c (diff)
Apply canonicalizations to path GrShapes.
The following canonicalizations of path-backed GrShapes are added: *convex shapes are stored with even/odd (or inv even/odd) fill. *filled paths are closed. *dashed paths ignore inverseness of the fill This will improve the results of queries about the geometry that will be added in a future change. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2067283003 Review-Url: https://codereview.chromium.org/2067283003
Diffstat (limited to 'tests/GrShapeTest.cpp')
-rw-r--r--tests/GrShapeTest.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/GrShapeTest.cpp b/tests/GrShapeTest.cpp
index 81fde47ff8..39cc8da933 100644
--- a/tests/GrShapeTest.cpp
+++ b/tests/GrShapeTest.cpp
@@ -314,6 +314,12 @@ void check_equivalence(skiatest::Reporter* r, const GrShape& a, const GrShape& b
} else {
REPORTER_ASSERT(r, keyA == keyB);
}
+ if (a.style().isSimpleFill() != b.style().isSimpleFill()) {
+ // GrShape will close paths with simple fill style. Make the non-filled path closed
+ // so that the comparision will succeed. Make sure both are closed before comparing.
+ pA.close();
+ pB.close();
+ }
REPORTER_ASSERT(r, pA == pB);
REPORTER_ASSERT(r, aIsRRect == bIsRRect);
if (aIsRRect) {
@@ -1347,7 +1353,8 @@ DEF_TEST(GrShape, reporter) {
}
struct TestPath {
- TestPath(const SkPath& path, bool isRRectFill, bool isRRectStroke, bool isLine, const SkRRect& rrect)
+ TestPath(const SkPath& path, bool isRRectFill, bool isRRectStroke, bool isLine,
+ const SkRRect& rrect)
: fPath(path)
, fIsRRectForFill(isRRectFill)
, fIsRRectForStroke(isRRectStroke)