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

Unified Diff: experimental/SkV8Example/Path2D.h

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/DrawingMethods.cpp ('k') | experimental/SkV8Example/Path2D.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkV8Example/Path2D.h
diff --git a/experimental/SkV8Example/Path2D.h b/experimental/SkV8Example/Path2D.h
index 93c1299c61e29c42163205c18651945ba854e8b2..4ac9877fd790c7e4e997d1a18f718e6ce9508075 100644
--- a/experimental/SkV8Example/Path2D.h
+++ b/experimental/SkV8Example/Path2D.h
@@ -17,36 +17,35 @@
class Global;
+// Path2D bridges between JS and SkPath.
class Path2D : SkNoncopyable {
public:
- Path2D() : fSkPath() {}
- virtual ~Path2D() {}
-
- const SkPath& getSkPath() { return fSkPath; }
-
- // The JS Path2D constuctor implementation.
- static void ConstructPath(const v8::FunctionCallbackInfo<v8::Value>& args);
-
- // Add the Path2D JS constructor to the global context.
- static void AddToGlobal(Global* global);
-
- // Path2D JS methods.
- static void ClosePath(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void MoveTo(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void LineTo(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void QuadraticCurveTo(
- const v8::FunctionCallbackInfo<v8::Value>& args);
- static void BezierCurveTo(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void Arc(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void Rect(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void Oval(const v8::FunctionCallbackInfo<v8::Value>& args);
- static void ConicTo(const v8::FunctionCallbackInfo<v8::Value>& args);
+ Path2D(SkPath* path);
+ virtual ~Path2D();
+
+ static void AddToGlobal(Global* global) {
+ gGlobal = global;
+ }
+
+ v8::Persistent<v8::Object>& persistent() {
+ return handle_;
+ }
+
+ SkPath* path() {
+ return path_;
+ }
+
private:
- SkPath fSkPath;
+ // The handle to this object in JS space.
+ v8::Persistent<v8::Object> handle_;
- static Path2D* Unwrap(const v8::FunctionCallbackInfo<v8::Value>& args);
+ SkPath* path_;
+ // The global context we are running in.
static Global* gGlobal;
+
+ // The template for what a JS Path2D object looks like.
+ static v8::Persistent<v8::ObjectTemplate> gPath2DTemplate;
};
#endif
« no previous file with comments | « experimental/SkV8Example/DrawingMethods.cpp ('k') | experimental/SkV8Example/Path2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698