Browse Source

new path on {stroke,fill}Rect()

v1.x
Tj Holowaychuk 15 years ago
parent
commit
b51b617e4d
  1. 2
      src/CanvasRenderingContext2d.cc
  2. 2
      test/canvas.test.js

2
src/CanvasRenderingContext2d.cc

@ -801,6 +801,7 @@ 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->getContext(); cairo_t *ctx = context->getContext();
cairo_new_path(ctx);
cairo_rectangle(ctx, x, y, width, height); cairo_rectangle(ctx, x, y, width, height);
SET_SOURCE(context->state->fill); SET_SOURCE(context->state->fill);
cairo_fill(ctx); cairo_fill(ctx);
@ -818,6 +819,7 @@ 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->getContext(); cairo_t *ctx = context->getContext();
cairo_new_path(ctx);
cairo_rectangle(ctx, x, y, width, height); cairo_rectangle(ctx, x, y, width, height);
SET_SOURCE(context->state->stroke); SET_SOURCE(context->state->stroke);
cairo_stroke(ctx); cairo_stroke(ctx);

2
test/canvas.test.js

@ -412,7 +412,7 @@ module.exports = {
assertChecksum( assertChecksum(
canvas canvas
, path , path
, 'fc8bbf2cf6ae2d85fcf526103200e844' , '65a027e653ea817747ba73053d48272a'
, 'Context2d#save() / restore() failed'); , 'Context2d#save() / restore() failed');
}, },

Loading…
Cancel
Save