From 63e4a4b3dfdb56075759bc883fe17081b86cd2ed Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Sat, 6 Nov 2010 14:44:49 -0700 Subject: [PATCH] Misc --- src/CanvasRenderingContext2d.cc | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 030e429..9a880ab 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -802,7 +802,27 @@ Context2d::Stroke(const Arguments &args) { HandleScope scope; Context2d *context = ObjectWrap::Unwrap(args.This()); cairo_t *ctx = context->getContext(); - SET_SOURCE(context->state->stroke); + + if (!context->hasShadow()) { + SET_SOURCE(context->state->stroke); + cairo_stroke_preserve(ctx); + return Undefined(); + } + + cairo_save(ctx); + cairo_translate( + ctx + , context->state->shadowOffsetX + , context->state->shadowOffsetY); + + SET_SOURCE_RGBA(context->state->shadow); + cairo_stroke_preserve(ctx); + + if (context->state->shadowBlur) { + Canvas::blur(context->getCanvas()->getSurface(), context->state->shadowBlur); + } + + cairo_restore(ctx); cairo_stroke_preserve(ctx); return Undefined(); }