From 884715c153c8d6718c93d429252610ee864f2045 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Tue, 5 Oct 2010 14:50:03 -0700 Subject: [PATCH] rect optimizations --- src/context2d.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/context2d.cc b/src/context2d.cc index f92f072..37d5b9e 100644 --- a/src/context2d.cc +++ b/src/context2d.cc @@ -613,6 +613,7 @@ Handle Context2d::FillRect(const Arguments &args) { HandleScope scope; RECT_ARGS; + if (0 == width || 0 == height) return Undefined(); Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->getContext(); cairo_rectangle(ctx, x, y, width, height); @@ -629,6 +630,7 @@ Handle Context2d::StrokeRect(const Arguments &args) { HandleScope scope; RECT_ARGS; + if (0 == width && 0 == height) return Undefined(); Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->getContext(); cairo_rectangle(ctx, x, y, width, height); @@ -645,6 +647,7 @@ Handle Context2d::ClearRect(const Arguments &args) { HandleScope scope; RECT_ARGS; + if (0 == width || 0 == height) return Undefined(); Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->getContext(); cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR);