Browse Source

preserve current path during fillRect() and strokeRect()

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

6
src/CanvasRenderingContext2d.cc

@ -1640,9 +1640,10 @@ Context2d::FillRect(const Arguments &args) {
if (0 == width || 0 == height) return Undefined(); if (0 == width || 0 == height) return Undefined();
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->context(); cairo_t *ctx = context->context();
cairo_new_path(ctx); context->savePath();
cairo_rectangle(ctx, x, y, width, height); cairo_rectangle(ctx, x, y, width, height);
context->fill(); context->fill();
context->restorePath();
return Undefined(); return Undefined();
} }
@ -1657,9 +1658,10 @@ Context2d::StrokeRect(const Arguments &args) {
if (0 == width && 0 == height) return Undefined(); if (0 == width && 0 == height) return Undefined();
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->context(); cairo_t *ctx = context->context();
cairo_new_path(ctx); context->savePath();
cairo_rectangle(ctx, x, y, width, height); cairo_rectangle(ctx, x, y, width, height);
context->stroke(); context->stroke();
context->restorePath();
return Undefined(); return Undefined();
} }

Loading…
Cancel
Save