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

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

Issue 10154006: 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/Transform.js
diff --git a/chrome/test/data/third_party/spaceport/js/sprites/Transform.js b/chrome/test/data/third_party/spaceport/js/sprites/Transform.js
new file mode 100644
index 0000000000000000000000000000000000000000..9e4287c76e5e6b7d8128d6a5febfdecf66966a1b
--- /dev/null
+++ b/chrome/test/data/third_party/spaceport/js/sprites/Transform.js
@@ -0,0 +1,40 @@
+define([ ], function () {
+ function Transform(options) {
+ this.x = 0;
+ this.y = 0;
+ this.scaleX = 1;
+ this.scaleY = 1;
+ this.rotation = 0;
+
+ 'x,y,scaleX,scaleY,rotation'.split(',').forEach(function (prop) {
+ if (prop in options) {
+ this[prop] = options[prop];
+ }
+ }, this);
+
+ // Matrix <=> array index representation:
+ // [ 0 1 2 ]
+ // [ 3 4 5 ]
+ // [ - - - ]
+ var cos = Math.cos(this.rotation);
+ var sin = Math.sin(this.rotation);
+ this.matrix = [
+ cos * this.scaleX, -sin, this.x,
+ sin, cos * this.scaleY, this.y
+ ];
+
+ this.cssTransform2d = '' +
+ 'translate(' + this.x + 'px,' + this.y + 'px) ' +
+ 'scale(' + this.scaleX + ',' + this.scaleY + ') ' +
+ 'rotate(' + this.rotation + 'rad) ' +
+ '';
+
+ this.cssTransform3d = '' +
+ 'translate3D(' + this.x + 'px,' + this.y + 'px,0px) ' +
+ 'scale3D(' + this.scaleX + ',' + this.scaleY + ',1) ' +
+ 'rotate(' + this.rotation + 'rad) ' +
+ '';
+ }
+
+ return Transform;
+});
« no previous file with comments | « chrome/test/data/third_party/spaceport/js/index.js ('k') | chrome/test/data/third_party/spaceport/js/sprites/canvas.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698