diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 333f728..ba2b0b1 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -1052,21 +1052,18 @@ Context2d::FillRect(const Arguments &args) { return Undefined(); } + cairo_save(ctx); cairo_translate( ctx , context->state->shadowOffsetX , context->state->shadowOffsetY); cairo_rectangle(ctx, x, y, width, height); - SET_SOURCE(context->state->fill); + SET_SOURCE_RGBA(context->state->shadow); cairo_fill(ctx); Canvas::blur(context->getCanvas()->getSurface(), context->state->shadowBlur); - cairo_translate( - ctx - , -context->state->shadowOffsetX - , -context->state->shadowOffsetY); - + cairo_restore(ctx); context->restorePath(); cairo_fill(ctx); return Undefined(); diff --git a/src/CanvasRenderingContext2d.h b/src/CanvasRenderingContext2d.h index 2b65615..f9229ac 100644 --- a/src/CanvasRenderingContext2d.h +++ b/src/CanvasRenderingContext2d.h @@ -100,7 +100,7 @@ class Context2d: public node::ObjectWrap { static void SetShadowBlur(Local prop, Local val, const AccessorInfo &info); inline cairo_t *getContext(){ return _context; } inline Canvas *getCanvas(){ return _canvas; } - bool hasShadow(); + inline bool hasShadow(); void setTextPath(const char *str, double x, double y); void savePath(); void restorePath();