2 function SimpleCanvasStage(element, options, canvasObject)
4 Stage.call(this, element, options);
5 this.context = this.element.getContext("2d");
6 this.canvasObject = canvasObject;
9 SimpleCanvasStage.prototype = Object.create(Stage.prototype);
10 SimpleCanvasStage.prototype.constructor = SimpleCanvasStage;
11 SimpleCanvasStage.prototype.tune = function(count)
14 return this._objects.length;
17 for (var i = 0; i < count; ++i) {
18 this._objects.push(new this.canvasObject(this));
20 return this._objects.length;
23 count = Math.min(-count, this._objects.length);
24 this._objects.splice(-count, count);
26 return this._objects.length;
28 SimpleCanvasStage.prototype.animate = function()
30 var context = this.context;
31 this._objects.forEach(function(object) {
36 function SimpleCanvasAnimator(benchmark)
38 StageAnimator.call(this, benchmark);
39 this._context = benchmark._stage.context;
42 SimpleCanvasAnimator.prototype = Object.create(StageAnimator.prototype);
43 SimpleCanvasAnimator.prototype.constructor = SimpleCanvasAnimator;
44 SimpleCanvasAnimator.prototype.animate = function()
46 this._context.clearRect(0, 0, this._benchmark._stage.size.x, this._benchmark._stage.size.y);
47 return StageAnimator.prototype.animate.call(this);
51 function SimpleCanvasBenchmark(suite, test, options, recordTable, progressBar) {
53 options["addLimit"] = 100;
54 options["removeLimit"] = 1000;
55 StageBenchmark.call(this, suite, test, options, recordTable, progressBar);
57 SimpleCanvasBenchmark.prototype = Object.create(StageBenchmark.prototype);
58 SimpleCanvasBenchmark.prototype.constructor = SimpleCanvasBenchmark;
59 SimpleCanvasBenchmark.prototype.createAnimator = function() {
60 return new SimpleCanvasAnimator(this);