Refactor helper methods for getting random values for a stage.
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Feb 2016 23:31:51 +0000 (23:31 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 6 Feb 2016 23:31:51 +0000 (23:31 +0000)
Instead of requiring a Stage instance, just attach it to the Stage object.

* Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
* Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
* Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
* Animometer/tests/master/resources/canvas-tests.js:
* Animometer/tests/master/resources/particles.js:
* Animometer/tests/misc/resources/canvas-electrons.js:
* Animometer/tests/misc/resources/canvas-stars.js:
* Animometer/tests/misc/resources/compositing-transforms.js:
* Animometer/tests/resources/main.js:
* Animometer/tests/simple/resources/simple-canvas-paths.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196224 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-particles.js
PerformanceTests/Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js
PerformanceTests/Animometer/tests/master/resources/canvas-tests.js
PerformanceTests/Animometer/tests/master/resources/particles.js
PerformanceTests/Animometer/tests/misc/resources/canvas-electrons.js
PerformanceTests/Animometer/tests/misc/resources/canvas-stars.js
PerformanceTests/Animometer/tests/misc/resources/compositing-transforms.js
PerformanceTests/Animometer/tests/resources/main.js
PerformanceTests/Animometer/tests/simple/resources/simple-canvas-paths.js
PerformanceTests/ChangeLog

index 13b1727..b2d14ac 100644 (file)
@@ -5,8 +5,8 @@ BouncingCanvasShape = Utilities.createSubclass(BouncingCanvasParticle,
     {
         BouncingCanvasParticle.call(this, stage, stage.shape);
         this._fill = stage.fill;
-        this._color0 = stage.randomColor();
-        this._color1 = stage.randomColor();
+        this._color0 = Stage.randomColor();
+        this._color1 = Stage.randomColor();
     }, {
 
     _applyFill: function()
index 141e282..c43c8a5 100644 (file)
@@ -10,11 +10,11 @@ BouncingCssShape = Utilities.createSubclass(BouncingParticle,
         switch (stage.fill) {
         case "solid":
         default:
-            this.element.style.backgroundColor = stage.randomColor();
+            this.element.style.backgroundColor = Stage.randomColor();
             break;
 
         case "gradient":
-            this.element.style.background = "linear-gradient(" + stage.randomColor() + ", " + stage.randomColor() + ")";
+            this.element.style.background = "linear-gradient(" + Stage.randomColor() + ", " + Stage.randomColor() + ")";
             break;
         }
 
index e56ffd5..0665916 100644 (file)
@@ -3,10 +3,10 @@ function BouncingParticle(stage)
     this._stageSize = stage.size;
     this.size = stage.particleSize;
 
-    this.position = stage.randomPosition(stage.size.subtract(stage.particleSize));
-    this._angle = stage.randomAngle();
-    this._velocity = stage.randomVelocity(stage.maxVelocity);
-    this.rotater = stage.randomRotater();
+    this.position = Stage.randomPosition(stage.size.subtract(stage.particleSize));
+    this._angle = Stage.randomAngle();
+    this._velocity = Stage.randomVelocity(stage.maxVelocity);
+    this.rotater = Stage.randomRotater();
 }
 
 BouncingParticle.prototype =
index 88cebaa..48825ef 100644 (file)
@@ -39,7 +39,7 @@ BouncingSvgShape = Utilities.createSubclass(BouncingSvgParticle,
 
         case "solid":
         default:
-            this.element.setAttribute("fill", stage.randomColor());
+            this.element.setAttribute("fill", Stage.randomColor());
             break;
         }
     }
@@ -64,7 +64,7 @@ BouncingSvgShapesStage = Utilities.createSubclass(BouncingSvgParticlesStage,
         var gradient = DocumentExtension.createSvgElement("linearGradient", attrs, {}, this._ensureDefsIsCreated());
 
         for (var i = 0; i < stops; ++i) {
-            attrs = { offset: i * 100 / stops + "%", 'stop-color': this.randomColor() };
+            attrs = { offset: i * 100 / stops + "%", 'stop-color': Stage.randomColor() };
             DocumentExtension.createSvgElement("stop", attrs, {}, gradient);
         }
 
index c3d74b1..b02939d 100644 (file)
@@ -4,11 +4,11 @@
 
 function CanvasLineSegment(stage)
 {
-    var circle = stage.randomInt(0, 2);
+    var circle = Stage.randomInt(0, 2);
     this._color = ["#e01040", "#10c030", "#e05010"][circle];
     this._lineWidth = Math.pow(Math.random(), 12) * 20 + 3;
     this._omega = Math.random() * 3 + 0.2;
-    var theta = stage.randomAngle();
+    var theta = Stage.randomAngle();
     this._cosTheta = Math.cos(theta);
     this._sinTheta = Math.sin(theta);
     this._startX = stage.circleRadius * this._cosTheta + (0.5 + circle) / 3 * stage.size.x;
@@ -36,21 +36,21 @@ function CanvasArc(stage)
     var maxX = 6, maxY = 3;
     var distanceX = stage.size.x / maxX;
     var distanceY = stage.size.y / (maxY + 1);
-    var randY = stage.randomInt(0, maxY);
-    var randX = stage.randomInt(0, maxX - 1 * (randY % 2));
+    var randY = Stage.randomInt(0, maxY);
+    var randX = Stage.randomInt(0, maxX - 1 * (randY % 2));
 
     this._point = new Point(distanceX * (randX + (randY % 2) / 2), distanceY * (randY + .5));
 
     this._radius = 20 + Math.pow(Math.random(), 5) * (Math.min(distanceX, distanceY) / 1.8);
-    this._startAngle = stage.randomAngle();
-    this._endAngle = stage.randomAngle();
+    this._startAngle = Stage.randomAngle();
+    this._endAngle = Stage.randomAngle();
     this._omega = (Math.random() - 0.5) * 0.3;
-    this._counterclockwise = stage.randomBool();
+    this._counterclockwise = Stage.randomBool();
     var colors = ["#101010", "#808080", "#c0c0c0"];
     colors.push(["#e01040", "#10c030", "#e05010"][(randX + Math.ceil(randY / 2)) % 3]);
     this._color = colors[Math.floor(Math.random() * colors.length)];
     this._lineWidth = 1 + Math.pow(Math.random(), 5) * 30;
-    this._doStroke = stage.randomInt(0, 3) != 0;
+    this._doStroke = Stage.randomInt(0, 3) != 0;
 };
 
 CanvasArc.prototype.draw = function(context)
index a8ab130..8c9583d 100644 (file)
@@ -1,7 +1,7 @@
 function Particle(stage)
 {
     this.stage = stage;
-    this.rotater = this.stage.randomRotater();
+    this.rotater = Stage.randomRotater();
     this.reset();
     this.move();
 }
@@ -15,9 +15,9 @@ Particle.prototype =
         this.maxPosition = this.stage.size.subtract(this.size);
         this.position = new Point(this.stage.size.x / 2, this.stage.size.y / 4);
 
-        var angle = this.stage.randomInt(0, this.stage.emitSteps) / this.stage.emitSteps * Math.PI * 2 + Date.now()/1000*this.stage.emissionSpin;
+        var angle = Stage.randomInt(0, this.stage.emitSteps) / this.stage.emitSteps * Math.PI * 2 + Date.now()/1000*this.stage.emissionSpin;
         this._velocity = new Point(Math.sin(angle), Math.cos(angle))
-            .multiply(this.stage.random(.8, 1.2));
+            .multiply(Stage.random(.8, 1.2));
     },
 
     animate: function(timeDelta)
@@ -81,8 +81,8 @@ ParticlesStage = Utilities.createSubclass(Stage,
     initialize: function(benchmark)
     {
         Stage.prototype.initialize.call(this, benchmark);
-        this.emissionSpin = this.random(0, 3);
-        this.emitSteps = this.randomInt(4, 6);
+        this.emissionSpin = Stage.random(0, 3);
+        this.emitSteps = Stage.randomInt(4, 6);
     },
 
     animate: function(timeDelta)
index ed84fa0..abc2798 100644 (file)
@@ -6,15 +6,15 @@ function CanvasElectron(stage)
     this._stageSize = stage.size;
 
     var minSide = Math.min(this._stageSize.width, this._stageSize.height);
-    var radiusX = stage.random(minSide / 8, 7 * minSide / 16);
-    var radiusY = stage.random(minSide / 8, 3 * radiusX / 4);
+    var radiusX = Stage.random(minSide / 8, 7 * minSide / 16);
+    var radiusY = Stage.random(minSide / 8, 3 * radiusX / 4);
     this._orbitRadiuses = new Point(radiusX, radiusY);
-    this._radius = stage.random(5, 15);
-    this._direction = stage.randomInt(0, 2);
-    this._angle = stage.randomInt(0, 360);
-    this._color = stage.randomColor();
-    this._rotater = stage.randomRotater();
-    this._rotater.next(stage.random(0, this._rotater.interval));
+    this._radius = Stage.random(5, 15);
+    this._direction = Stage.randomInt(0, 2);
+    this._angle = Stage.randomInt(0, 360);
+    this._color = Stage.randomColor();
+    this._rotater = Stage.randomRotater();
+    this._rotater.next(Stage.random(0, this._rotater.interval));
 }
 
 CanvasElectron.prototype = {
index d886eec..d286148 100644 (file)
@@ -4,10 +4,10 @@ function CanvasStar(stage)
 {
     this._context = stage.context;
 
-    this._size = stage.randomSquareSize(5, 20);
-    this._center = stage.randomPosition(stage.size.subtract(this._size)).add(this._size.center);
+    this._size = Stage.randomSquareSize(5, 20);
+    this._center = Stage.randomPosition(stage.size.subtract(this._size)).add(this._size.center);
     this._rotateX = 0;
-    this._rotateDeltaX = stage.random(0.3, 0.7);
+    this._rotateDeltaX = Stage.random(0.3, 0.7);
 }
 
 CanvasStar.prototype = {
index abd1691..a03f553 100644 (file)
@@ -11,7 +11,7 @@ BouncingCompositedImage = Utilities.createSubclass(BouncingParticle,
         this.element.setAttribute("src", stage.imageSrc);
 
         if (stage.useFilters)
-            this.element.style.filter = "hue-rotate(" + stage.randomAngle() + "rad)";
+            this.element.style.filter = "hue-rotate(" + Stage.randomAngle() + "rad)";
 
         stage.element.appendChild(this.element);
         this._move();
index 6c06ba5..bb5064e 100644 (file)
@@ -82,35 +82,9 @@ BenchmarkState.prototype =
     }
 }
 
-
 function Stage() {}
 
-Stage.prototype =
-{
-    initialize: function(benchmark)
-    {
-        this._benchmark = benchmark;
-        this._element = document.getElementById("stage");
-        this._element.setAttribute("width", document.body.offsetWidth);
-        this._element.setAttribute("height", document.body.offsetHeight);
-        this._size = Point.elementClientSize(this._element).subtract(Insets.elementPadding(this._element).size);
-    },
-
-    get element()
-    {
-        return this._element;
-    },
-
-    get size()
-    {
-        return this._size;
-    },
-
-    complexity: function()
-    {
-        return 0;
-    },
-
+Utilities.extendObject(Stage, {
     random: function(min, max)
     {
         return (Math.random() * (max - min)) + min;
@@ -160,6 +134,33 @@ Stage.prototype =
     randomRotater: function()
     {
         return new Rotater(this.random(1000, 10000));
+    }
+});
+
+Stage.prototype =
+{
+    initialize: function(benchmark)
+    {
+        this._benchmark = benchmark;
+        this._element = document.getElementById("stage");
+        this._element.setAttribute("width", document.body.offsetWidth);
+        this._element.setAttribute("height", document.body.offsetHeight);
+        this._size = Point.elementClientSize(this._element).subtract(Insets.elementPadding(this._element).size);
+    },
+
+    get element()
+    {
+        return this._element;
+    },
+
+    get size()
+    {
+        return this._size;
+    },
+
+    complexity: function()
+    {
+        return 0;
     },
 
     tune: function()
index f496e4e..183779a 100644 (file)
@@ -3,14 +3,14 @@
 // === PAINT OBJECTS ===
 
 function CanvasLineSegment(stage) {
-    var radius = stage.randomInt(10, 100);
-    var center = stage.randomPosition(stage.size);
-    var delta = Point.pointOnCircle(stage.randomAngle(), radius/2);
+    var radius = Stage.randomInt(10, 100);
+    var center = Stage.randomPosition(stage.size);
+    var delta = Point.pointOnCircle(Stage.randomAngle(), radius/2);
 
     this._point1 = center.add(delta);
     this._point2 = center.subtract(delta);
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 100);
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 100);
 }
 CanvasLineSegment.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -23,21 +23,21 @@ CanvasLineSegment.prototype.draw = function(context) {
 
 function CanvasLinePoint(stage, coordinateMaximumFactor) {
     var pointMaximum = new Point(Math.min(stage.size.x, coordinateMaximumFactor * stage.size.x), Math.min(stage.size.y, coordinateMaximumFactor * stage.size.y));
-    this._point = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    this._point = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
 }
 CanvasLinePoint.prototype.draw = function(context) {
     context.lineTo(this._point.x, this._point.y);
 };
 
 function CanvasQuadraticSegment(stage) {
-    var maxSize = stage.randomInt(20, 200);
-    var toCenter = stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
-
-    this._point1 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point2 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point3 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 50);
+    var maxSize = Stage.randomInt(20, 200);
+    var toCenter = Stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
+
+    this._point1 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point2 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point3 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 50);
 };
 CanvasQuadraticSegment.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -49,24 +49,24 @@ CanvasQuadraticSegment.prototype.draw = function(context) {
 };
 
 function CanvasQuadraticPoint(stage, coordinateMaximumFactor) {
-    var pointMaximum = stage.randomPosition(new Point(Math.min(stage.size.x, coordinateMaximumFactor * stage.size.x), Math.min(stage.size.y, coordinateMaximumFactor * stage.size.y)));
-    this._point1 = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
-    this._point2 = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    var pointMaximum = Stage.randomPosition(new Point(Math.min(stage.size.x, coordinateMaximumFactor * stage.size.x), Math.min(stage.size.y, coordinateMaximumFactor * stage.size.y)));
+    this._point1 = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    this._point2 = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
 };
 CanvasQuadraticPoint.prototype.draw = function(context) {
     context.quadraticCurveTo(this._point1.x, this._point1.y, this._point2.x, this._point2.y);
 };
 
 function CanvasBezierSegment(stage) {
-    var maxSize = stage.randomInt(20, 200);
-    var toCenter = stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
-
-    this._point1 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point2 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point3 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point4 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 50);
+    var maxSize = Stage.randomInt(20, 200);
+    var toCenter = Stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
+
+    this._point1 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point2 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point3 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point4 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 50);
 };
 CanvasBezierSegment.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -78,25 +78,25 @@ CanvasBezierSegment.prototype.draw = function(context) {
 };
 
 function CanvasBezierPoint(stage, coordinateMaximumFactor) {
-    var pointMaximum = stage.randomPosition(new Point(Math.min(stage.size.x, coordinateMaximumFactor * stage.size.x), Math.min(stage.size.y, coordinateMaximumFactor * stage.size.y)));
-    this._point1 = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
-    this._point2 = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
-    this._point3 = stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    var pointMaximum = Stage.randomPosition(new Point(Math.min(stage.size.x, coordinateMaximumFactor * stage.size.x), Math.min(stage.size.y, coordinateMaximumFactor * stage.size.y)));
+    this._point1 = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    this._point2 = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
+    this._point3 = Stage.randomPosition(pointMaximum).add(new Point((stage.size.x - pointMaximum.x) / 2, (stage.size.y - pointMaximum.y) / 2));
 };
 CanvasBezierPoint.prototype.draw = function(context) {
     context.bezierCurveTo(this._point1.x, this._point1.y, this._point2.x, this._point2.y, this._point3.x, this._point3.y);
 };
 
 function CanvasArcToSegment(stage) {
-    var maxSize = stage.randomInt(20, 200);
-    var toCenter = stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
-
-    this._point1 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point2 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._point3 = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._radius = stage.randomInt(20, 200);
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 50);
+    var maxSize = Stage.randomInt(20, 200);
+    var toCenter = Stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
+
+    this._point1 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point2 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._point3 = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._radius = Stage.randomInt(20, 200);
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 50);
 };
 CanvasArcToSegment.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -119,16 +119,16 @@ CanvasArcToSegmentFill.prototype.draw = function(context) {
 };
 
 function CanvasArcSegment(stage) {
-    var maxSize = stage.randomInt(20, 200);
-    var toCenter = stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
-
-    this._point = stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
-    this._radius = stage.randomInt(20, 200);
-    this._startAngle = stage.randomAngle();
-    this._endAngle = stage.randomAngle();
-    this._counterclockwise = stage.randomBool();
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 50);
+    var maxSize = Stage.randomInt(20, 200);
+    var toCenter = Stage.randomPosition(stage.size).subtract(new Point(maxSize/2, maxSize/2));
+
+    this._point = Stage.randomPosition(new Point(maxSize, maxSize)).add(toCenter);
+    this._radius = Stage.randomInt(20, 200);
+    this._startAngle = Stage.randomAngle();
+    this._endAngle = Stage.randomAngle();
+    this._counterclockwise = Stage.randomBool();
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 50);
 };
 CanvasArcSegment.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -149,11 +149,11 @@ CanvasArcSegmentFill.prototype.draw = function(context) {
 };
 
 function CanvasRect(stage) {
-    this._width = stage.randomInt(20, 200);
-    this._height = stage.randomInt(20, 200);
-    this._point = stage.randomPosition(stage.size).subtract(new Point(this._width/2, this._height/2));
-    this._color = stage.randomColor();
-    this._lineWidth = stage.randomInt(1, 20);
+    this._width = Stage.randomInt(20, 200);
+    this._height = Stage.randomInt(20, 200);
+    this._point = Stage.randomPosition(stage.size).subtract(new Point(this._width/2, this._height/2));
+    this._color = Stage.randomColor();
+    this._lineWidth = Stage.randomInt(1, 20);
 }
 CanvasRect.prototype.draw = function(context) {
     context.strokeStyle = this._color;
@@ -184,8 +184,8 @@ SimpleCanvasPathStrokeStage = Utilities.createSubclass(SimpleCanvasStage,
     {
         var context = this.context;
         context.clearRect(0, 0, this.size.x, this.size.y);
-        context.lineWidth = this.randomInt(1, 20);
-        context.strokeStyle = this.randomColor();
+        context.lineWidth = Stage.randomInt(1, 20);
+        context.strokeStyle = Stage.randomColor();
         context.beginPath();
         context.moveTo(this.size.x / 2, this.size.y / 2);
         this.objects.forEach(function(object) {
@@ -204,7 +204,7 @@ SimpleCanvasPathFillStage = Utilities.createSubclass(SimpleCanvasStage,
     {
         var context = this.context;
         context.clearRect(0, 0, this.size.x, this.size.y);
-        context.fillStyle = this.randomColor();
+        context.fillStyle = Stage.randomColor();
         context.beginPath();
         context.moveTo(this.size.x / 2, this.size.y / 2);
         this.objects.forEach(function(object) {
index fcacdd4..b22b9b3 100644 (file)
@@ -1,3 +1,21 @@
+2016-02-06  Jon Lee  <jonlee@apple.com>
+
+        Refactor helper methods for getting random values for a stage.
+
+        Instead of requiring a Stage instance, just attach it to the Stage object.
+
+        * Animometer/tests/bouncing-particles/resources/bouncing-canvas-shapes.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-css-shapes.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-particles.js:
+        * Animometer/tests/bouncing-particles/resources/bouncing-svg-shapes.js:
+        * Animometer/tests/master/resources/canvas-tests.js:
+        * Animometer/tests/master/resources/particles.js:
+        * Animometer/tests/misc/resources/canvas-electrons.js:
+        * Animometer/tests/misc/resources/canvas-stars.js:
+        * Animometer/tests/misc/resources/compositing-transforms.js:
+        * Animometer/tests/resources/main.js:
+        * Animometer/tests/simple/resources/simple-canvas-paths.js:
+
 2016-02-05  Said Abou-Hallawa  <sabouhallawa@apple.com>
 
         Add a new graphics test for CanvasRenderingContext2D functions: getImageData and putImageData