Chromium Code Reviews| Index: src/gpu/GrTestUtils.cpp |
| diff --git a/src/gpu/GrTestUtils.cpp b/src/gpu/GrTestUtils.cpp |
| index 00742e955ce29ab94ec5db5b90271cfa4127dc20..3f74bb92fc5b43410c9c8109bb29953b526d42ea 100644 |
| --- a/src/gpu/GrTestUtils.cpp |
| +++ b/src/gpu/GrTestUtils.cpp |
| @@ -171,6 +171,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 = |
|
robertphillips
2015/05/07 19:30:24
Should we add a 'kInitStyleCount ' ?
joshualitt
2015/05/07 21:22:39
Well, there is a macro which Mike Klein made to ma
|
| + SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1)); |
| + SkStrokeRec rec(style); |
| + bool strokeAndFill = random->nextBool(); |
|
robertphillips
2015/05/07 19:30:24
A width one too? Maybe 10?
joshualitt
2015/05/07 21:22:39
you want me to make an enum of possible widths wit
robertphillips
2015/05/08 12:02:07
I was just angling for a wider one (i.e., a stroke
|
| + 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 |