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

Unified Diff: experimental/SkV8Example/Path.cpp

Issue 161223002: Add conicTo(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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/Path.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
+ );
+}
« no previous file with comments | « experimental/SkV8Example/Path.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698