OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrTestUtils.h" | 8 #include "GrTestUtils.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 gPath[6].lineTo(5.0f, 5.0f); | 168 gPath[6].lineTo(5.0f, 5.0f); |
169 gPath[6].lineTo(10.0f, 0.0f); | 169 gPath[6].lineTo(10.0f, 0.0f); |
170 gPath[6].lineTo(10.0f, 10.0f); | 170 gPath[6].lineTo(10.0f, 10.0f); |
171 gPath[6].lineTo(0.0f, 10.0f); | 171 gPath[6].lineTo(0.0f, 10.0f); |
172 gPath[6].close(); | 172 gPath[6].close(); |
173 } | 173 } |
174 | 174 |
175 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPat
h)))]; | 175 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPat
h)))]; |
176 } | 176 } |
177 | 177 |
| 178 SkStrokeRec TestStrokeRec(SkRandom* random) { |
| 179 SkStrokeRec::InitStyle style = |
| 180 SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_Init
Style + 1)); |
| 181 SkStrokeRec rec(style); |
| 182 bool strokeAndFill = random->nextBool(); |
| 183 SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f; |
| 184 rec.setStrokeStyle(strokeWidth, strokeAndFill); |
| 185 |
| 186 SkPaint::Cap cap = SkPaint::Cap(random->nextULessThan(SkPaint::kCapCount)); |
| 187 SkPaint::Join join = SkPaint::Join(random->nextULessThan(SkPaint::kJoinCount
)); |
| 188 SkScalar miterLimit = random->nextRangeScalar(1.f, 5.f); |
| 189 rec.setStrokeParams(cap, join, miterLimit); |
| 190 return rec; |
| 191 } |
| 192 |
178 }; | 193 }; |
179 | 194 |
180 #endif | 195 #endif |
OLD | NEW |