summaryrefslogtreecommitdiffstats
path: root/third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-svg-images.js
blob: 2239557312015eeded8a09308e98fad3fb42ad41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
(function() {

BouncingSvgImage = Utilities.createSubclass(BouncingSvgParticle,
    function(stage)
    {
        BouncingSvgParticle.call(this, stage, "image");

        var attrs = { x: 0, y: 0, width: this.size.x, height: this.size.y };
        var xlinkAttrs = { href: stage.imageSrc };
        this.element = Utilities.createSVGElement("image", attrs, xlinkAttrs, stage.element);
        this._move();
    }
);

BouncingSvgImagesStage = Utilities.createSubclass(BouncingSvgParticlesStage,
    function()
    {
        BouncingSvgParticlesStage.call(this);
    }, {

    initialize: function(benchmark, options)
    {
        BouncingSvgParticlesStage.prototype.initialize.call(this, benchmark, options);
        this.imageSrc = options["imageSrc"] || "resources/yin-yang.svg";
    },

    createParticle: function()
    {
        return new BouncingSvgImage(this);
    }
});

BouncingSvgImagesBenchmark = Utilities.createSubclass(Benchmark,
    function(options)
    {
        Benchmark.call(this, new BouncingSvgImagesStage(), options);
    }
);

window.benchmarkClass = BouncingSvgImagesBenchmark;

})();