From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- .../resources/bouncing-canvas-images.js | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js (limited to 'third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js') diff --git a/third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js b/third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js new file mode 100644 index 0000000000..5fba5ad761 --- /dev/null +++ b/third_party/webkit/PerformanceTests/MotionMark/tests/bouncing-particles/resources/bouncing-canvas-images.js @@ -0,0 +1,47 @@ +(function() { + +BouncingCanvasImage = Utilities.createSubclass(BouncingCanvasParticle, + function(stage) + { + BouncingCanvasParticle.call(this, stage, "image"); + this._imageElement = stage.imageElement; + }, { + + _draw: function() + { + this.context.save(); + this.applyRotation(); + this.context.drawImage(this._imageElement, 0, 0, this.size.x, this.size.y); + this.context.restore(); + } +}); + +BouncingCanvasImagesStage = Utilities.createSubclass(BouncingCanvasParticlesStage, + function() + { + BouncingCanvasParticlesStage.call(this); + }, { + + initialize: function(benchmark, options) + { + BouncingCanvasParticlesStage.prototype.initialize.call(this, benchmark, options); + var imageSrc = options["imageSrc"] || "resources/yin-yang.svg"; + this.imageElement = document.querySelector(".hidden[src=\"" + imageSrc + "\"]"); + }, + + createParticle: function() + { + return new BouncingCanvasImage(this); + } +}); + +BouncingCanvasImagesBenchmark = Utilities.createSubclass(Benchmark, + function(options) + { + Benchmark.call(this, new BouncingCanvasImagesStage(), options); + } +); + +window.benchmarkClass = BouncingCanvasImagesBenchmark; + +})(); -- cgit v1.2.3