| 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 "GrColor.h" | 11 #include "GrColor.h" |
| 12 #include "SkRandom.h" | 12 #include "SkRandom.h" |
| 13 | 13 |
| 14 class SkMatrix; | 14 class SkMatrix; |
| 15 class SkRect; |
| 15 | 16 |
| 16 namespace GrTest { | 17 namespace GrTest { |
| 17 /** | 18 /** |
| 18 * A helper for use in Test functions. | 19 * A helper for use in Test functions. |
| 19 */ | 20 */ |
| 20 const SkMatrix& TestMatrix(SkRandom*); | 21 const SkMatrix& TestMatrix(SkRandom*); |
| 22 const SkRect& TestRect(SkRandom*); |
| 21 | 23 |
| 22 } | 24 } |
| 23 | 25 |
| 24 static inline GrColor GrRandomColor(SkRandom* random) { | 26 static inline GrColor GrRandomColor(SkRandom* random) { |
| 25 // There are only a few cases of random colors which interest us | 27 // There are only a few cases of random colors which interest us |
| 26 enum ColorMode { | 28 enum ColorMode { |
| 27 kAllOnes_ColorMode, | 29 kAllOnes_ColorMode, |
| 28 kAllZeros_ColorMode, | 30 kAllZeros_ColorMode, |
| 29 kAlphaOne_ColorMode, | 31 kAlphaOne_ColorMode, |
| 30 kRandom_ColorMode, | 32 kRandom_ColorMode, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 coverage = 0xff; | 77 coverage = 0xff; |
| 76 break; | 78 break; |
| 77 case kRandom_CoverageMode: | 79 case kRandom_CoverageMode: |
| 78 coverage = random->nextULessThan(256); | 80 coverage = random->nextULessThan(256); |
| 79 break; | 81 break; |
| 80 } | 82 } |
| 81 return coverage; | 83 return coverage; |
| 82 } | 84 } |
| 83 | 85 |
| 84 #endif | 86 #endif |
| OLD | NEW |