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