aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm
diff options
context:
space:
mode:
Diffstat (limited to 'gm')
-rw-r--r--gm/points.cpp10
-rw-r--r--gm/strokerects.cpp4
-rw-r--r--gm/strokes.cpp4
3 files changed, 4 insertions, 14 deletions
diff --git a/gm/points.cpp b/gm/points.cpp
index 4aa65975b6..ff535cd24d 100644
--- a/gm/points.cpp
+++ b/gm/points.cpp
@@ -28,14 +28,8 @@ protected:
}
static void fill_pts(SkPoint pts[], size_t n, SkRandom* rand) {
- for (size_t i = 0; i < n; i++) {
- // Compute these independently and store in variables, rather
- // than in the parameter-passing expression, to get consistent
- // evaluation order across compilers.
- float y = rand->nextUScalar1() * 480;
- float x = rand->nextUScalar1() * 640;
- pts[i].set(x, y);
- }
+ for (size_t i = 0; i < n; i++)
+ pts[i].set(rand->nextUScalar1() * 640, rand->nextUScalar1() * 480);
}
virtual void onDraw(SkCanvas* canvas) {
diff --git a/gm/strokerects.cpp b/gm/strokerects.cpp
index 44c012029c..29d8cb0ae8 100644
--- a/gm/strokerects.cpp
+++ b/gm/strokerects.cpp
@@ -38,11 +38,9 @@ protected:
SkScalar y = rand.nextUScalar1() * H;
SkScalar w = rand.nextUScalar1() * (W >> 2);
SkScalar h = rand.nextUScalar1() * (H >> 2);
- SkScalar hoffset = rand.nextSScalar1();
- SkScalar woffset = rand.nextSScalar1();
r->set(x, y, x + w, y + h);
- r->offset(-w/2 + woffset, -h/2 + hoffset);
+ r->offset(-w/2 + rand.nextSScalar1(), -h/2 + + rand.nextSScalar1());
}
virtual void onDraw(SkCanvas* canvas) {
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index d8b21b2f2e..862a517d5f 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -25,11 +25,9 @@ static void rnd_rect(SkRect* r, SkPaint* paint, SkRandom& rand) {
SkScalar y = rand.nextUScalar1() * H;
SkScalar w = rand.nextUScalar1() * (W >> 2);
SkScalar h = rand.nextUScalar1() * (H >> 2);
- SkScalar hoffset = rand.nextSScalar1();
- SkScalar woffset = rand.nextSScalar1();
r->set(x, y, x + w, y + h);
- r->offset(-w/2 + woffset, -h/2 + hoffset);
+ r->offset(-w/2 + rand.nextSScalar1(), -h/2 + + rand.nextSScalar1());
paint->setColor(rand.nextU());
paint->setAlpha(0xFF);