aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/SkV8Example
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-13 16:00:58 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-13 16:00:58 +0000
commite1df56579f815fe1f788380e9342abe5284bab51 (patch)
tree134cc405ab94d7352baeddfb00ac1276a5a7f11c /experimental/SkV8Example
parentea7d08e3bbc45a0a573c1ac06afa4452f8d7000a (diff)
Add conicTo().
BUG=skia: R=robertphillips@google.com Author: jcgregorio@google.com Review URL: https://codereview.chromium.org/161223002 git-svn-id: http://skia.googlecode.com/svn/trunk@13431 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/SkV8Example')
-rw-r--r--experimental/SkV8Example/Path.cpp24
-rw-r--r--experimental/SkV8Example/Path.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/experimental/SkV8Example/Path.cpp b/experimental/SkV8Example/Path.cpp
index 90574f40f0..b2af1f7d44 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)
+ );
+}
diff --git a/experimental/SkV8Example/Path.h b/experimental/SkV8Example/Path.h
index 3c21c9c0f4..370f168a2e 100644
--- a/experimental/SkV8Example/Path.h
+++ b/experimental/SkV8Example/Path.h
@@ -40,6 +40,7 @@ public:
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);
private:
SkPath fSkPath;