Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6681)

Unified Diff: chrome/test/data/third_party/spaceport/js/sprites/sources/image.js

Issue 10134041: Add test data for spaceport benchmark. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/third_party/spaceport/js/sprites/sources/image.js
diff --git a/chrome/test/data/third_party/spaceport/js/sprites/sources/image.js b/chrome/test/data/third_party/spaceport/js/sprites/sources/image.js
new file mode 100644
index 0000000000000000000000000000000000000000..146022836606b84d808b6b00aa1f86bc0665534d
--- /dev/null
+++ b/chrome/test/data/third_party/spaceport/js/sprites/sources/image.js
@@ -0,0 +1,39 @@
+define([ 'util/ensureCallback' ], function (ensureCallback) {
+ var IMAGE_SRC = 'assets/html5-logo.png';
+
+ function ImageSource(img) {
+ this.img = img;
+
+ this.frameInfo = {
+ x: 0,
+ y: 0,
+ width: img.width,
+ height: img.height,
+ image: img,
+ sheetImage: img
+ };
+ }
+
+ ImageSource.prototype.getImage = function getImage(frameIndex) {
+ return this.img;
+ };
+
+ ImageSource.prototype.drawToCanvas = function drawToCanvas(context, dx, dy, frameIndex) {
+ context.drawImage(this.img, dx, dy);
+ };
+
+ ImageSource.prototype.getFrameInfo = function getFrameInfo(frameIndex) {
+ return this.frameInfo;
+ };
+
+ return function image(callback) {
+ callback = ensureCallback(callback);
+
+ var img = new window.Image();
+ img.onload = function () {
+ var imageSource = new ImageSource(img);
+ callback(null, imageSource);
+ };
+ img.src = IMAGE_SRC;
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698