Browse Source

special case of zero-width rectangle

Signed-off-by: Tj Holowaychuk <tj@vision-media.ca>
v1.x
atomizer 14 years ago
committed by Tj Holowaychuk
parent
commit
24c327ac5e
  1. 11
      src/CanvasRenderingContext2d.cc

11
src/CanvasRenderingContext2d.cc

@ -1695,7 +1695,16 @@ Context2d::Rect(const Arguments &args) {
HandleScope scope;
RECT_ARGS;
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_rectangle(context->context(), x, y, width, height);
cairo_t *ctx = context->context();
if (width == 0) {
cairo_move_to(ctx, x, y);
cairo_line_to(ctx, x, y + height);
} else if (height == 0) {
cairo_move_to(ctx, x, y);
cairo_line_to(ctx, x + width, y);
} else {
cairo_rectangle(ctx, x, y, width, height);
}
return Undefined();
}

Loading…
Cancel
Save