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