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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 define([ 'util/ensureCallback' ], function (ensureCallback) {
2 var IMAGE_SRC = 'assets/html5-logo.png';
3
4 function ImageSource(img) {
5 this.img = img;
6
7 this.frameInfo = {
8 x: 0,
9 y: 0,
10 width: img.width,
11 height: img.height,
12 image: img,
13 sheetImage: img
14 };
15 }
16
17 ImageSource.prototype.getImage = function getImage(frameIndex) {
18 return this.img;
19 };
20
21 ImageSource.prototype.drawToCanvas = function drawToCanvas(context, dx, dy, frameIndex) {
22 context.drawImage(this.img, dx, dy);
23 };
24
25 ImageSource.prototype.getFrameInfo = function getFrameInfo(frameIndex) {
26 return this.frameInfo;
27 };
28
29 return function image(callback) {
30 callback = ensureCallback(callback);
31
32 var img = new window.Image();
33 img.onload = function () {
34 var imageSource = new ImageSource(img);
35 callback(null, imageSource);
36 };
37 img.src = IMAGE_SRC;
38 };
39 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698