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 #ifndef GrTestUtils_DEFINED | 8 #ifndef GrTestUtils_DEFINED |
9 #define GrTestUtils_DEFINED | 9 #define GrTestUtils_DEFINED |
10 | 10 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 | 12 |
13 #ifdef GR_TEST_UTILS | 13 #ifdef GR_TEST_UTILS |
14 | 14 |
15 #include "GrColor.h" | 15 #include "GrColor.h" |
16 #include "SkRandom.h" | 16 #include "SkRandom.h" |
| 17 #include "SkStrokeRec.h" |
17 | 18 |
18 class SkMatrix; | 19 class SkMatrix; |
19 class SkPath; | 20 class SkPath; |
20 class SkRRect; | 21 class SkRRect; |
21 struct SkRect; | 22 struct SkRect; |
22 | 23 |
23 namespace GrTest { | 24 namespace GrTest { |
24 /** | 25 /** |
25 * A helper for use in Test functions. | 26 * A helper for use in Test functions. |
26 */ | 27 */ |
27 const SkMatrix& TestMatrix(SkRandom*); | 28 const SkMatrix& TestMatrix(SkRandom*); |
28 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); | 29 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); |
29 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); | 30 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); |
30 const SkMatrix& TestMatrixInvertible(SkRandom*); | 31 const SkMatrix& TestMatrixInvertible(SkRandom*); |
31 const SkRect& TestRect(SkRandom*); | 32 const SkRect& TestRect(SkRandom*); |
32 const SkRRect& TestRRectSimple(SkRandom*); | 33 const SkRRect& TestRRectSimple(SkRandom*); |
33 const SkPath& TestPath(SkRandom*); | 34 const SkPath& TestPath(SkRandom*); |
| 35 SkStrokeRec TestStrokeRec(SkRandom*); |
34 | 36 |
35 } | 37 } |
36 | 38 |
37 static inline GrColor GrRandomColor(SkRandom* random) { | 39 static inline GrColor GrRandomColor(SkRandom* random) { |
38 // There are only a few cases of random colors which interest us | 40 // There are only a few cases of random colors which interest us |
39 enum ColorMode { | 41 enum ColorMode { |
40 kAllOnes_ColorMode, | 42 kAllOnes_ColorMode, |
41 kAllZeros_ColorMode, | 43 kAllZeros_ColorMode, |
42 kAlphaOne_ColorMode, | 44 kAlphaOne_ColorMode, |
43 kRandom_ColorMode, | 45 kRandom_ColorMode, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 break; | 92 break; |
91 case kRandom_CoverageMode: | 93 case kRandom_CoverageMode: |
92 coverage = random->nextULessThan(256); | 94 coverage = random->nextULessThan(256); |
93 break; | 95 break; |
94 } | 96 } |
95 return coverage; | 97 return coverage; |
96 } | 98 } |
97 | 99 |
98 #endif | 100 #endif |
99 #endif | 101 #endif |
OLD | NEW |