These calls to SkRandom are not sequenced.
This is why we see two versions of this GM: some compilers evaluate the
rand.nextRangeScalar() calls left to right, others right to left.
Remember this bug?
BUG=skia:3241
(https://codereview.chromium.org/1157943006 fixed hittestpath last year.)
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2368263002
Review-Url: https://codereview.chromium.org/2368263002
diff --git a/gm/beziers.cpp b/gm/beziers.cpp
index cf65c0b..ffc3ba6 100755
--- a/gm/beziers.cpp
+++ b/gm/beziers.cpp
@@ -18,8 +18,11 @@
static void rnd_quad(SkPath* p, SkPaint* paint, SkRandom& rand) {
p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H));
for (int x = 0; x < 2; ++x) {
- p->quadTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H),
- rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H));
+ auto a = rand.nextRangeScalar(W/4, W),
+ b = rand.nextRangeScalar( 0, H),
+ c = rand.nextRangeScalar( 0, W),
+ d = rand.nextRangeScalar(H/4, H);
+ p->quadTo(a,b,c,d);
}
paint->setColor(rand.nextU());
SkScalar width = rand.nextRangeScalar(1, 5);
@@ -29,11 +32,17 @@
}
static void rnd_cubic(SkPath* p, SkPaint* paint, SkRandom& rand) {
- p->moveTo(rand.nextRangeScalar(0, W), rand.nextRangeScalar(0, H));
+ auto a = rand.nextRangeScalar(0,W),
+ b = rand.nextRangeScalar(0,H);
+ p->moveTo(a,b);
for (int x = 0; x < 2; ++x) {
- p->cubicTo(rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(0, H),
- rand.nextRangeScalar(0, W), rand.nextRangeScalar(H / 4, H),
- rand.nextRangeScalar(W / 4, W), rand.nextRangeScalar(H / 4, H));
+ auto c = rand.nextRangeScalar(W/4, W),
+ d = rand.nextRangeScalar( 0, H),
+ e = rand.nextRangeScalar( 0, W),
+ f = rand.nextRangeScalar(H/4, H),
+ g = rand.nextRangeScalar(W/4, W),
+ h = rand.nextRangeScalar(H/4, H);
+ p->cubicTo(c,d,e,f,g,h);
}
paint->setColor(rand.nextU());
SkScalar width = rand.nextRangeScalar(1, 5);