Index: experimental/SkV8Example/Path.cpp |
diff --git a/experimental/SkV8Example/Path.cpp b/experimental/SkV8Example/Path.cpp |
index 90574f40f031f892563daeb1244a5dbc82708f6d..b2af1f7d44b5b07dcd370971af46bdecd728c98e 100644 |
--- a/experimental/SkV8Example/Path.cpp |
+++ b/experimental/SkV8Example/Path.cpp |
@@ -51,6 +51,7 @@ void Path::AddToGlobal(Global* global) { |
ADD_METHOD("arc", Arc); |
ADD_METHOD("rect", Rect); |
ADD_METHOD("oval", Oval); |
+ ADD_METHOD("conicTo", ConicTo); |
context->Global()->Set(String::NewFromUtf8( |
gGlobal->getIsolate(), "Path"), constructor->GetFunction()); |
@@ -218,3 +219,26 @@ void Path::Oval(const v8::FunctionCallbackInfo<Value>& args) { |
path->fSkPath.addOval(rect, dir); |
} |
+ |
+void Path::ConicTo(const v8::FunctionCallbackInfo<Value>& args) { |
+ if (args.Length() != 5) { |
+ args.GetIsolate()->ThrowException( |
+ v8::String::NewFromUtf8( |
+ args.GetIsolate(), "Error: 5 args required.")); |
+ return; |
+ } |
+ double x1 = args[0]->NumberValue(); |
+ double y1 = args[1]->NumberValue(); |
+ double x2 = args[2]->NumberValue(); |
+ double y2 = args[3]->NumberValue(); |
+ double w = args[4]->NumberValue(); |
+ Path* path = Unwrap(args); |
+ |
+ path->fSkPath.conicTo( |
+ SkDoubleToScalar(x1), |
+ SkDoubleToScalar(y1), |
+ SkDoubleToScalar(x2), |
+ SkDoubleToScalar(y2), |
+ SkDoubleToScalar(w) |
+ ); |
+} |