| 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;
|
| + };
|
| +});
|
|
|