diff options
author | caryclark <caryclark@google.com> | 2015-06-04 09:27:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-04 09:27:43 -0700 |
commit | 99a69eb152840c56e54244c3953f901be1d7d7bc (patch) | |
tree | 0480e44232aa33c4b772af071c895b3958fbfcce /gm/hittestpath.cpp | |
parent | 0709ca09530123470fcbeff2bddda38d7a7ce3f8 (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.cpp | 17 |
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); |