aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/hittestpath.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-06-04 09:27:43 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-04 09:27:43 -0700
commit99a69eb152840c56e54244c3953f901be1d7d7bc (patch)
tree0480e44232aa33c4b772af071c895b3958fbfcce /gm/hittestpath.cpp
parent0709ca09530123470fcbeff2bddda38d7a7ce3f8 (diff)
make test hittestpath random calls deterministic
R=bsalomon@google.com Review URL: https://codereview.chromium.org/1157943006
Diffstat (limited to 'gm/hittestpath.cpp')
-rw-r--r--gm/hittestpath.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/gm/hittestpath.cpp b/gm/hittestpath.cpp
index 42e3671551..f415ba3785 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);