435f2ce563448ff24469ffd5a00e9bb1457a9bb6
[WebKit-https.git] / PerformanceTests / Animometer / tests / bouncing-particles / resources / bouncing-svg-images.js
1 function BouncingSvgImage(stage)
2 {
3     BouncingSvgParticle.call(this, stage);
4     this._shape = "image";
5     
6     var attrs = { x: 0, y: 0, width: this._size.x, height: this._size.y };
7     var xlinkAttrs = { href: stage.imageSrc };
8     this.element = DocumentExtension.createSvgElement("image", attrs, xlinkAttrs, stage.element);
9     this._move();
10 }
11
12 BouncingSvgImage.prototype = Object.create(BouncingSvgParticle.prototype);
13 BouncingSvgImage.prototype.constructor = BouncingSvgImage;
14
15 function BouncingSvgImagesStage(element, options)
16 {
17     BouncingParticlesStage.call(this, element, options);
18     this.imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
19 }
20
21 BouncingSvgImagesStage.prototype = Object.create(BouncingSvgParticlesStage.prototype);
22 BouncingSvgImagesStage.prototype.constructor = BouncingSvgImagesStage;
23
24 BouncingSvgImagesStage.prototype.createParticle = function()
25 {
26     return new BouncingSvgImage(this);
27 }
28
29 function BouncingSvgImagesBenchmark(suite, test, options, progressBar)
30 {
31     BouncingParticlesBenchmark.call(this, suite, test, options, progressBar);
32 }
33
34 BouncingSvgImagesBenchmark.prototype = Object.create(BouncingParticlesBenchmark.prototype);
35 BouncingSvgImagesBenchmark.prototype.constructor = BouncingSvgImagesBenchmark;
36
37 BouncingSvgImagesBenchmark.prototype.createStage = function(element)
38 {
39     return new BouncingSvgImagesStage(element, this._options);
40 }
41
42 window.benchmarkClient.create = function(suite, test, options, progressBar)
43 {
44     return new BouncingSvgImagesBenchmark(suite, test, options, progressBar);
45 }