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
This commit is contained in:
parent
ea7d08e3bb
commit
e1df56579f
@ -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)
|
||||
);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user