Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Unified Diff: gm/hittestpath.cpp

Issue 1157943006: make test random calls deterministic (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/hittestpath.cpp
diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp
index 42e367155150a1fb89c09a6301dee310113e95dc..f415ba3785dbaee1a0128c5e067e04c366cd6577 100644
--- a/gm/hittestpath.cpp
+++ b/gm/hittestpath.cpp
@@ -47,12 +47,17 @@ protected:
int scale = 300;
for (int i = 0; i < 4; ++i) {
- path.lineTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
- path.quadTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale,
- rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
- path.cubicTo(rand.nextUScalar1() * scale, rand.nextUScalar1() * scale,
- rand.nextUScalar1() * scale, rand.nextUScalar1() * scale,
- rand.nextUScalar1() * scale, rand.nextUScalar1() * scale);
+ // get the random values deterministically
+ SkScalar randoms[12];
+ for (int index = 0; index < (int) SK_ARRAY_COUNT(randoms); ++index) {
+ randoms[index] = rand.nextUScalar1();
+ }
+ path.lineTo(randoms[0] * scale, randoms[1] * scale);
+ path.quadTo(randoms[2] * scale, randoms[3] * scale,
+ randoms[4] * scale, randoms[5] * scale);
+ path.cubicTo(randoms[6] * scale, randoms[7] * scale,
+ randoms[8] * scale, randoms[9] * scale,
+ randoms[10] * scale, randoms[11] * scale);
}
path.setFillType(SkPath::kEvenOdd_FillType);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698