aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrTestUtils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrTestUtils.cpp')
-rw-r--r--src/gpu/GrTestUtils.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp
index 0bb4044eaa..39f4834657 100644
--- a/src/gpu/GrTestUtils.cpp
+++ b/src/gpu/GrTestUtils.cpp
@@ -175,6 +175,21 @@ const SkPath& TestPath(SkRandom* random) {
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));
+ SkStrokeRec rec(style);
+ bool strokeAndFill = random->nextBool();
+ SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f;
+ rec.setStrokeStyle(strokeWidth, strokeAndFill);
+
+ SkPaint::Cap cap = SkPaint::Cap(random->nextULessThan(SkPaint::kCapCount));
+ SkPaint::Join join = SkPaint::Join(random->nextULessThan(SkPaint::kJoinCount));
+ SkScalar miterLimit = random->nextRangeScalar(1.f, 5.f);
+ rec.setStrokeParams(cap, join, miterLimit);
+ return rec;
+}
+
};
#endif