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

Unified Diff: experimental/SkV8Example/js/sample.js

Issue 661033005: SkV8Sample: Now with Path2D and Path2DBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: path* Created 6 years, 2 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
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/v8.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/js/sample.js
diff --git a/experimental/SkV8Example/js/sample.js b/experimental/SkV8Example/js/sample.js
index 7e7e40a918c02957bcc92d5db641db0ea461c5a3..f04da337e2a4d52880f4668770bec9d010a61714 100644
--- a/experimental/SkV8Example/js/sample.js
+++ b/experimental/SkV8Example/js/sample.js
@@ -2,23 +2,28 @@
* @fileoverview Sample onDraw script for use with SkV8Example.
*/
var onDraw = function(){
- var tick = 0;
- var p = new Path2D();
- p.rect(0, 0, 200, 200);
+ var ticks = 0;
+ var b = new Path2DBuilder();
+ b.rect(0, 0, 200, 200);
+ var p = b.finalize();
function f(context) {
- tick += 0.1;
+ ticks += 1;
context.translate(context.width/2, context.height/2);
- context.rotate(tick);
+ context.rotate(ticks/10);
context.drawPath(p);
+
+ inval();
};
+
+ function onTimeout() {
+ console.log(ticks);
+ ticks = 0;
+ setTimeout(onTimeout, 1000);
+ }
+ setTimeout(onTimeout, 1000);
+
return f;
}();
-function onTimeout() {
- inval();
- print(setTimeout(onTimeout, 33));
-}
-
-setTimeout(onTimeout, 33);
« no previous file with comments | « experimental/SkV8Example/SkV8Example.cpp ('k') | gyp/v8.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698