Lines Matching refs:random

21 static const SkMatrix& test_matrix(SkRandom* random,
44 return gMatrices[random->nextULessThan(count)];
46 return gMatrices[count - 1 - random->nextULessThan(kPerspectiveCount)];
49 return gMatrices[random->nextULessThan(count - kPerspectiveCount)];
54 const SkMatrix& TestMatrix(SkRandom* random) { return test_matrix(random, true, true); }
56 const SkMatrix& TestMatrixPreservesRightAngles(SkRandom* random) {
79 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))];
82 const SkMatrix& TestMatrixRectStaysRect(SkRandom* random) {
105 return gMatrices[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gMatrices)))];
108 const SkMatrix& TestMatrixInvertible(SkRandom* random) { return test_matrix(random, true, false); }
109 const SkMatrix& TestMatrixPerspective(SkRandom* random) { return test_matrix(random, false, true); }
111 void TestWrapModes(SkRandom* random, GrSamplerState::WrapMode wrapModes[2]) {
117 wrapModes[0] = kWrapModes[random->nextULessThan(SK_ARRAY_COUNT(kWrapModes))];
118 wrapModes[1] = kWrapModes[random->nextULessThan(SK_ARRAY_COUNT(kWrapModes))];
120 const SkRect& TestRect(SkRandom* random) {
132 return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRects)))];
136 const SkRect& TestSquare(SkRandom* random) {
144 return gRects[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRects)))];
147 const SkRRect& TestRRectSimple(SkRandom* random) {
162 return gRRect[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gRRect)))];
165 const SkPath& TestPath(SkRandom* random) {
210 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
213 const SkPath& TestPathConvex(SkRandom* random) {
244 return gPath[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gPath)))];
247 static void randomize_stroke_rec(SkStrokeRec* rec, SkRandom* random) {
248 bool strokeAndFill = random->nextBool();
249 SkScalar strokeWidth = random->nextBool() ? 0.f : 1.f;
252 SkPaint::Cap cap = SkPaint::Cap(random->nextULessThan(SkPaint::kCapCount));
253 SkPaint::Join join = SkPaint::Join(random->nextULessThan(SkPaint::kJoinCount));
254 SkScalar miterLimit = random->nextRangeScalar(1.f, 5.f);
258 SkStrokeRec TestStrokeRec(SkRandom* random) {
260 SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
262 randomize_stroke_rec(&rec, random);
266 void TestStyle(SkRandom* random, GrStyle* style) {
268 SkStrokeRec::InitStyle(random->nextULessThan(SkStrokeRec::kFill_InitStyle + 1));
270 randomize_stroke_rec(&stroke, random);
272 if (random->nextBool()) {
273 int cnt = random->nextRangeU(1, 50) * 2;
277 intervals[i] = random->nextRangeScalar(SkDoubleToScalar(0.01),
281 SkScalar phase = random->nextRangeScalar(0, sum);
312 sk_sp<SkColorSpace> TestColorSpace(SkRandom* random) {
323 return gColorSpaces[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gColorSpaces)))];
326 sk_sp<GrColorSpaceXform> TestColorXform(SkRandom* random) {
341 return gXforms[random->nextULessThan(static_cast<uint32_t>(SK_ARRAY_COUNT(gXforms)))];
354 GrColor RandomColor(SkRandom* random) {
355 // There are only a few cases of random colors which interest us
364 ColorMode colorMode = ColorMode(random->nextULessThan(kLast_ColorMode + 1));
374 color = GrColorPackRGBA(random->nextULessThan(256),
375 random->nextULessThan(256),
376 random->nextULessThan(256),
380 uint8_t alpha = random->nextULessThan(256);
381 color = GrColorPackRGBA(random->nextRangeU(0, alpha),
382 random->nextRangeU(0, alpha),
383 random->nextRangeU(0, alpha),
391 uint8_t RandomCoverage(SkRandom* random) {
399 CoverageMode colorMode = CoverageMode(random->nextULessThan(kLast_CoverageMode + 1));
409 coverage = random->nextULessThan(256);