| 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 #include "SkStrokeRec.h" | 17 #include "SkStrokeRec.h" |
| 18 | 18 |
| 19 class GrStrokeInfo; | |
| 20 class SkMatrix; | 19 class SkMatrix; |
| 21 class SkPath; | 20 class SkPath; |
| 22 class SkRRect; | 21 class SkRRect; |
| 23 struct SkRect; | 22 struct SkRect; |
| 24 | 23 |
| 25 namespace GrTest { | 24 namespace GrTest { |
| 26 /** | 25 /** |
| 27 * A helper for use in Test functions. | 26 * A helper for use in Test functions. |
| 28 */ | 27 */ |
| 29 const SkMatrix& TestMatrix(SkRandom*); | 28 const SkMatrix& TestMatrix(SkRandom*); |
| 30 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); | 29 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*); |
| 31 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); | 30 const SkMatrix& TestMatrixRectStaysRect(SkRandom*); |
| 32 const SkMatrix& TestMatrixInvertible(SkRandom*); | 31 const SkMatrix& TestMatrixInvertible(SkRandom*); |
| 33 const SkRect& TestRect(SkRandom*); | 32 const SkRect& TestRect(SkRandom*); |
| 34 const SkRect& TestSquare(SkRandom*); | 33 const SkRect& TestSquare(SkRandom*); |
| 35 const SkRRect& TestRRectSimple(SkRandom*); | 34 const SkRRect& TestRRectSimple(SkRandom*); |
| 36 const SkPath& TestPath(SkRandom*); | 35 const SkPath& TestPath(SkRandom*); |
| 37 const SkPath& TestPathConvex(SkRandom*); | 36 const SkPath& TestPathConvex(SkRandom*); |
| 38 SkStrokeRec TestStrokeRec(SkRandom*); | 37 SkStrokeRec TestStrokeRec(SkRandom*); |
| 39 GrStrokeInfo TestStrokeInfo(SkRandom*); | |
| 40 | 38 |
| 41 } | 39 } |
| 42 | 40 |
| 43 static inline GrColor GrRandomColor(SkRandom* random) { | 41 static inline GrColor GrRandomColor(SkRandom* random) { |
| 44 // There are only a few cases of random colors which interest us | 42 // There are only a few cases of random colors which interest us |
| 45 enum ColorMode { | 43 enum ColorMode { |
| 46 kAllOnes_ColorMode, | 44 kAllOnes_ColorMode, |
| 47 kAllZeros_ColorMode, | 45 kAllZeros_ColorMode, |
| 48 kAlphaOne_ColorMode, | 46 kAlphaOne_ColorMode, |
| 49 kRandom_ColorMode, | 47 kRandom_ColorMode, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 break; | 94 break; |
| 97 case kRandom_CoverageMode: | 95 case kRandom_CoverageMode: |
| 98 coverage = random->nextULessThan(256); | 96 coverage = random->nextULessThan(256); |
| 99 break; | 97 break; |
| 100 } | 98 } |
| 101 return coverage; | 99 return coverage; |
| 102 } | 100 } |
| 103 | 101 |
| 104 #endif | 102 #endif |
| 105 #endif | 103 #endif |
| OLD | NEW |