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/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp
index dc36fc1..e306ed4 100644
--- a/src/gpu/GrDefaultGeoProcFactory.cpp
+++ b/src/gpu/GrDefaultGeoProcFactory.cpp
@@ -275,13 +275,18 @@
flags |= kLocalCoordAttribute_GPFlag;
}
+ GrColor color = GrRandomColor(d->fRandom);
+ SkMatrix viewMtx = GrTest::TestMatrix(d->fRandom);
+ SkMatrix localMtx = GrTest::TestMatrix(d->fRandom);
+ bool readsLocalCoords = d->fRandom->nextBool();
+ uint8_t coverage = GrRandomCoverage(d->fRandom);
return DefaultGeoProc::Make(d->allocator(),
flags,
- SkPMColor4f::FromBytes_RGBA(GrRandomColor(d->fRandom)),
- GrTest::TestMatrix(d->fRandom),
- GrTest::TestMatrix(d->fRandom),
- d->fRandom->nextBool(),
- GrRandomCoverage(d->fRandom));
+ SkPMColor4f::FromBytes_RGBA(color),
+ viewMtx,
+ localMtx,
+ readsLocalCoords,
+ coverage);
}
#endif