Index: src/gpu/GrTestUtils.cpp |
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp |
index 39f4834657ea72ea6917de2020e284f8c0e59be2..c91f0fc8a916915c1e6a77e2f1df5879506bd232 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)); |