From 780148ebcfe7ac59c4b407313e7f63e208e34ada Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Fri, 11 Mar 2011 13:46:01 -0800 Subject: [PATCH] Fixed more HandleScopes --- src/CanvasRenderingContext2d.cc | 41 ++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index c9aa5c4..46e21a3 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -910,8 +910,9 @@ Context2d::SetAntiAlias(Local prop, Local val, const AccessorInfo Handle Context2d::GetMiterLimit(Local prop, const AccessorInfo &info) { + HandleScope scope; Context2d *context = ObjectWrap::Unwrap(info.This()); - return Number::New(cairo_get_miter_limit(context->context())); + return scope.Close(Number::New(cairo_get_miter_limit(context->context()))); } /* @@ -933,8 +934,9 @@ Context2d::SetMiterLimit(Local prop, Local val, const AccessorInf Handle Context2d::GetLineWidth(Local prop, const AccessorInfo &info) { + HandleScope scope; Context2d *context = ObjectWrap::Unwrap(info.This()); - return Number::New(cairo_get_line_width(context->context())); + return scope.Close(Number::New(cairo_get_line_width(context->context()))); } /* @@ -956,15 +958,15 @@ Context2d::SetLineWidth(Local prop, Local val, const AccessorInfo Handle Context2d::GetLineJoin(Local prop, const AccessorInfo &info) { + HandleScope scope; Context2d *context = ObjectWrap::Unwrap(info.This()); + const char *join; switch (cairo_get_line_join(context->context())) { - case CAIRO_LINE_JOIN_BEVEL: - return String::NewSymbol("bevel"); - case CAIRO_LINE_JOIN_ROUND: - return String::NewSymbol("round"); - default: - return String::NewSymbol("miter"); + case CAIRO_LINE_JOIN_BEVEL: join = "bevel"; break; + case CAIRO_LINE_JOIN_ROUND: join = "round"; break; + default: join = "miter"; } + return scope.Close(String::NewSymbol(join)); } /* @@ -991,15 +993,15 @@ Context2d::SetLineJoin(Local prop, Local val, const AccessorInfo Handle Context2d::GetLineCap(Local prop, const AccessorInfo &info) { + HandleScope scope; Context2d *context = ObjectWrap::Unwrap(info.This()); + const char *cap; switch (cairo_get_line_cap(context->context())) { - case CAIRO_LINE_CAP_ROUND: - return String::NewSymbol("round"); - case CAIRO_LINE_CAP_SQUARE: - return String::NewSymbol("square"); - default: - return String::NewSymbol("butt"); + case CAIRO_LINE_CAP_ROUND: cap = "round"; break; + case CAIRO_LINE_CAP_SQUARE: cap = "square"; break; + default: cap = "butt"; } + return scope.Close(String::NewSymbol(cap)); } /* @@ -1032,7 +1034,7 @@ Context2d::IsPointInPath(const Arguments &args) { cairo_t *ctx = context->context(); double x = args[0]->NumberValue() , y = args[1]->NumberValue(); - return Boolean::New(cairo_in_fill(ctx, x, y) || cairo_in_stroke(ctx, x, y)); + return scope.Close(Boolean::New(cairo_in_fill(ctx, x, y) || cairo_in_stroke(ctx, x, y))); } return False(); } @@ -1094,10 +1096,11 @@ Context2d::SetShadowColor(Local prop, Local val, const AccessorIn Handle Context2d::GetShadowColor(Local prop, const AccessorInfo &info) { + HandleScope scope; char buf[64]; Context2d *context = ObjectWrap::Unwrap(info.This()); rgba_to_string(context->state->shadow, buf); - return String::New(buf); + return scope.Close(String::New(buf)); } /* @@ -1124,10 +1127,11 @@ Context2d::SetFillColor(const Arguments &args) { Handle Context2d::GetFillColor(Local prop, const AccessorInfo &info) { + HandleScope scope; char buf[64]; Context2d *context = ObjectWrap::Unwrap(info.This()); rgba_to_string(context->state->fill, buf); - return String::New(buf); + return scope.Close(String::New(buf)); } /* @@ -1154,10 +1158,11 @@ Context2d::SetStrokeColor(const Arguments &args) { Handle Context2d::GetStrokeColor(Local prop, const AccessorInfo &info) { + HandleScope scope; char buf[64]; Context2d *context = ObjectWrap::Unwrap(info.This()); rgba_to_string(context->state->stroke, buf); - return String::New(buf); + return scope.Close(String::New(buf)); } /*