Fetch random numbers for TestCreate in a predictable order.
We want our randomized tests to behave predictably when given a fixed
seed, but C++ is allowed to arbitrarily reorder our calls to
random->nextXxxx() when we call it more than once on the same line.
Each random-fetching call is now performed separately.
Change-Id: I8d9c0fcd7e5c931d3a963a2e401ea8b66535fc4f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/402716
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/ops/GrOvalOpFactory.cpp b/src/gpu/ops/GrOvalOpFactory.cpp
index e5ab493..0d0b3e8 100644
--- a/src/gpu/ops/GrOvalOpFactory.cpp
+++ b/src/gpu/ops/GrOvalOpFactory.cpp
@@ -721,9 +721,11 @@
#if GR_TEST_UTILS
GrGeometryProcessor* EllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) {
- return EllipseGeometryProcessor::Make(d->allocator(), d->fRandom->nextBool(),
- d->fRandom->nextBool(), d->fRandom->nextBool(),
- GrTest::TestMatrix(d->fRandom));
+ bool stroke = d->fRandom->nextBool();
+ bool wideColor = d->fRandom->nextBool();
+ bool useScale = d->fRandom->nextBool();
+ SkMatrix matrix = GrTest::TestMatrix(d->fRandom);
+ return EllipseGeometryProcessor::Make(d->allocator(), stroke, wideColor, useScale, matrix);
}
#endif
@@ -920,9 +922,11 @@
#if GR_TEST_UTILS
GrGeometryProcessor* DIEllipseGeometryProcessor::TestCreate(GrProcessorTestData* d) {
- return DIEllipseGeometryProcessor::Make(d->allocator(), d->fRandom->nextBool(),
- d->fRandom->nextBool(), GrTest::TestMatrix(d->fRandom),
- (DIEllipseStyle)(d->fRandom->nextRangeU(0, 2)));
+ bool wideColor = d->fRandom->nextBool();
+ bool useScale = d->fRandom->nextBool();
+ SkMatrix matrix = GrTest::TestMatrix(d->fRandom);
+ auto style = (DIEllipseStyle)(d->fRandom->nextRangeU(0, 2));
+ return DIEllipseGeometryProcessor::Make(d->allocator(), wideColor, useScale, matrix, style);
}
#endif