diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 0640a9a..d81fd39 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -8,6 +8,7 @@ #include #include #include +#include #include "Canvas.h" #include "Point.h" #include "Image.h" @@ -2033,7 +2034,7 @@ NAN_METHOD(Context2d::SetLineDash) { Handle dash = Handle::Cast(args[0]); uint32_t dashes = dash->Length() & 1 ? dash->Length() * 2 : dash->Length(); - double a[dashes]; + std::vector a(dashes); for (uint32_t i=0; i d = dash->Get(i % dash->Length()); if (!d->IsNumber()) NanReturnUndefined(); @@ -2045,7 +2046,7 @@ NAN_METHOD(Context2d::SetLineDash) { cairo_t *ctx = context->context(); double offset; cairo_get_dash(ctx, NULL, &offset); - cairo_set_dash(ctx, a, dashes, offset); + cairo_set_dash(ctx, a.data(), dashes, offset); NanReturnUndefined(); } @@ -2059,8 +2060,8 @@ NAN_METHOD(Context2d::GetLineDash) { Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->context(); int dashes = cairo_get_dash_count(ctx); - double a[dashes]; - cairo_get_dash(ctx, a, NULL); + std::vector a(dashes); + cairo_get_dash(ctx, a.data(), NULL); Local dash = NanNew(dashes); for (int i=0; icontext(); int dashes = cairo_get_dash_count(ctx); - double a[dashes]; - cairo_get_dash(ctx, a, NULL); - cairo_set_dash(ctx, a, dashes, offset); + std::vector a(dashes); + cairo_get_dash(ctx, a.data(), NULL); + cairo_set_dash(ctx, a.data(), dashes, offset); } /*