8 #ifndef GrTestUtils_DEFINED
9 #define GrTestUtils_DEFINED
16 #include "SkPathEffect.h"
18 #include "SkStrokeRec.h"
19 #include "../private/SkTemplates.h"
31 const SkMatrix& TestMatrix(SkRandom*);
32 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom*);
33 const SkMatrix& TestMatrixRectStaysRect(SkRandom*);
34 const SkMatrix& TestMatrixInvertible(SkRandom*);
35 const SkMatrix& TestMatrixPerspective(SkRandom*);
36 const SkRect& TestRect(SkRandom*);
37 const SkRect& TestSquare(SkRandom*);
38 const SkRRect& TestRRectSimple(SkRandom*);
39 const SkPath& TestPath(SkRandom*);
40 const SkPath& TestPathConvex(SkRandom*);
43 void TestStyle(SkRandom*, GrStyle*);
54 DashType asADash(DashInfo* info)
const override;
55 Factory getFactory()
const override {
return nullptr; }
56 void toString(
SkString*)
const override {}
59 TestDashPathEffect(
const SkScalar* intervals,
int count, SkScalar phase);
62 SkAutoTArray<SkScalar> fIntervals;
64 SkScalar fInitialDashLength;
65 int fInitialDashIndex;
66 SkScalar fIntervalLength;
71 static inline GrColor GrRandomColor(SkRandom* random) {
78 kLast_ColorMode = kRandom_ColorMode
81 ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1));
82 GrColor color SK_INIT_TO_AVOID_WARNING;
84 case kAllOnes_ColorMode:
85 color = GrColorPackRGBA(0xFF, 0xFF, 0xFF, 0xFF);
87 case kAllZeros_ColorMode:
88 color = GrColorPackRGBA(0, 0, 0, 0);
90 case kAlphaOne_ColorMode:
91 color = GrColorPackRGBA(random->nextULessThan(256),
92 random->nextULessThan(256),
93 random->nextULessThan(256),
96 case kRandom_ColorMode: {
97 uint8_t alpha = random->nextULessThan(256);
98 color = GrColorPackRGBA(random->nextRangeU(0, alpha),
99 random->nextRangeU(0, alpha),
100 random->nextRangeU(0, alpha),
105 GrColorIsPMAssert(color);
109 static inline uint8_t GrRandomCoverage(SkRandom* random) {
112 kAllOnes_CoverageMode,
113 kRandom_CoverageMode,
114 kLast_CoverageMode = kRandom_CoverageMode
117 CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMode + 1));
118 uint8_t coverage SK_INIT_TO_AVOID_WARNING;
120 case kZero_CoverageMode:
123 case kAllOnes_CoverageMode:
126 case kRandom_CoverageMode:
127 coverage = random->nextULessThan(256);
The SkRRect class represents a rounded rect with a potentially different radii for each corner...
Definition: SkRRect.h:48
The SkPath class encapsulates compound (multiple contour) geometric paths consisting of straight line...
Definition: SkPath.h:27
SkPathEffect is the base class for objects in the SkPaint that affect the geometry of a drawing primi...
Definition: SkPathEffect.h:29
Definition: SkStrokeRec.h:16
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
Light weight class for managing strings.
Definition: SkString.h:121