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 | 17 |
18 class SkMatrix; | 18 class SkMatrix; |
19 class SkPath; | 19 class SkPath; |
20 class SkRRect; | 20 class SkRRect; |
21 struct SkRect; | 21 struct SkRect; |
22 | 22 |
23 namespace GrTest { | 23 namespace GrTest { |
24 /** | 24 /** |
25 * A helper for use in Test functions. | 25 * A helper for use in Test functions. |
26 */ | 26 */ |
27 const SkMatrix& TestMatrix(SkRandom*); | 27 const SkMatrix& TestMatrix(SkRandom*); |
28 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); | 28 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); |
29 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); | 29 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); |
| 30 const SkMatrix& TestMatrixInvertible(SkRandom*); |
30 const SkRect& TestRect(SkRandom*); | 31 const SkRect& TestRect(SkRandom*); |
31 const SkRRect& TestRRectSimple(SkRandom*); | 32 const SkRRect& TestRRectSimple(SkRandom*); |
32 const SkPath& TestPath(SkRandom*); | 33 const SkPath& TestPath(SkRandom*); |
33 | 34 |
34 } | 35 } |
35 | 36 |
36 static inline GrColor GrRandomColor(SkRandom* random) { | 37 static inline GrColor GrRandomColor(SkRandom* random) { |
37 // There are only a few cases of random colors which interest us | 38 // There are only a few cases of random colors which interest us |
38 enum ColorMode { | 39 enum ColorMode { |
39 kAllOnes_ColorMode, | 40 kAllOnes_ColorMode, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 break; | 90 break; |
90 case kRandom_CoverageMode: | 91 case kRandom_CoverageMode: |
91 coverage = random->nextULessThan(256); | 92 coverage = random->nextULessThan(256); |
92 break; | 93 break; |
93 } | 94 } |
94 return coverage; | 95 return coverage; |
95 } | 96 } |
96 | 97 |
97 #endif | 98 #endif |
98 #endif | 99 #endif |
OLD | NEW |