aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTestUtils.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-05-11 08:58:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-11 08:58:52 -0700
commit8e5c177c8589e00f630ac6fae763c65cb9cae896 (patch)
treeafc0834755fa19c1bc4e9c48e394fcf8b3f47142 /src/gpu/GrTestUtils.cpp
parent79dfb2b6b6db7b2e703810d26dbdc90cf3ea40f9 (diff)
convex path renderer unit tests
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1134753002
Diffstat (limited to 'src/gpu/GrTestUtils.cpp')
-rw-r--r--src/gpu/GrTestUtils.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 39f4834657..c91f0fc8a9 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -175,6 +175,36 @@ const SkPath& TestPath(SkRandom* random) {
return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
}
+const SkPath& TestPathConvex(SkRandom* random) {
+ static SkPath gPath[3];
+ static bool gOnce;
+ if (!gOnce) {
+ gOnce = true;
+ // narrow rect
+ gPath[0].moveTo(0.f, 0.f);
+ gPath[0].lineTo(-1.5f, -50.0f);
+ gPath[0].lineTo( 1.5f, -50.0f);
+ gPath[0].lineTo( 1.5f, 50.0f);
+ gPath[0].lineTo(-1.5f, 50.0f);
+ // degenerate
+ gPath[1].moveTo(0.f, 0.f);
+ gPath[1].lineTo(-0.025f, -0.025f);
+ gPath[1].lineTo( 0.025f, -0.025f);
+ gPath[1].lineTo( 0.025f, 0.025f);
+ gPath[1].lineTo(-0.025f, 0.025f);
+ // clipped triangle
+ gPath[2].moveTo(0.f, 0.f);
+ gPath[2].lineTo(-10.0f, -50.0f);
+ gPath[2].lineTo( 10.0f, -50.0f);
+ gPath[2].lineTo( 50.0f, 31.0f);
+ gPath[2].lineTo( 40.0f, 50.0f);
+ gPath[2].lineTo(-40.0f, 50.0f);
+ gPath[2].lineTo(-50.0f, 31.0f);
+ }
+
+ return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
+}
+
SkStrokeRec TestStrokeRec(SkRandom* random) {
SkStrokeRec::InitStyle style =
SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));