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