Browse Source

Use of Local<Value>

v1.x
Tj Holowaychuk 14 years ago
parent
commit
4c7788fd68
  1. 13
      src/Canvas.cc
  2. 2
      src/Canvas.h

13
src/Canvas.cc

@ -155,12 +155,12 @@ EIO_AfterToBuffer(eio_req *req) {
ev_unref(EV_DEFAULT_UC);
if (closure->status) {
Handle<Value> argv[1] = { Canvas::Error(closure->status) };
Local<Value> argv[1] = { Canvas::Error(closure->status) };
closure->pfn->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
Buffer *buf = Buffer::New(closure->len);
memcpy(buf->data(), closure->data, closure->len);
Handle<Value> argv[2] = { Null(), buf->handle_ };
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(buf->handle_) };
closure->pfn->Call(Context::GetCurrent()->Global(), 2, argv);
}
@ -248,10 +248,13 @@ Canvas::StreamPNGSync(const Arguments &args) {
if (try_catch.HasCaught()) {
return try_catch.ReThrow();
} else if (status) {
Handle<Value> argv[1] = { Canvas::Error(status) };
Local<Value> argv[1] = { Canvas::Error(status) };
closure.fn->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
Handle<Value> argv[3] = { Null(), Null(), Integer::New(0) };
Local<Value> argv[3] = {
Local<Value>::New(Null())
, Local<Value>::New(Null())
, Integer::New(0) };
closure.fn->Call(Context::GetCurrent()->Global(), 3, argv);
}
return Undefined();
@ -289,7 +292,7 @@ Canvas::resurface() {
* Construct an Error from the given cairo status.
*/
Handle<Value>
Local<Value>
Canvas::Error(cairo_status_t status) {
return Exception::Error(String::New(cairo_status_to_string(status)));
}

2
src/Canvas.h

@ -58,7 +58,7 @@ class Canvas: public node::ObjectWrap {
static void SetWidth(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static void SetHeight(Local<String> prop, Local<Value> val, const AccessorInfo &info);
static Handle<Value> StreamPNGSync(const Arguments &args);
static Handle<Value> Error(cairo_status_t status);
static Local<Value> Error(cairo_status_t status);
inline cairo_surface_t *getSurface(){ return _surface; }
Canvas(int width, int height);
void resurface();

Loading…
Cancel
Save