From 8b6fbf64c076d8645b6d45317c4cbd3365236074 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Mon, 8 Nov 2010 11:32:14 -0800 Subject: [PATCH] Fixed gradients --- src/CanvasRenderingContext2d.cc | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 54b77aa..527db5a 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -25,16 +25,6 @@ using namespace node; _.b = B / 255 * 1; \ _.a = A; \ -/* - * Set source. - */ - -#define SET_SOURCE(_) \ - if (_##Pattern) \ - cairo_set_source(ctx, _##Pattern); \ - else \ - context->setSourceRGBA(_) - /* * Rectangle arg assertions. */ @@ -227,7 +217,10 @@ Context2d::restorePath() { void Context2d::fill(bool preserve) { - setSourceRGBA(state->fill); + state->fillPattern + ? cairo_set_source(_context, state->fillPattern) + : setSourceRGBA(state->fill); + if (preserve) { hasShadow() ? shadow(cairo_fill_preserve) @@ -245,7 +238,10 @@ Context2d::fill(bool preserve) { void Context2d::stroke(bool preserve) { - setSourceRGBA(state->stroke); + state->strokePattern + ? cairo_set_source(_context, state->strokePattern) + : setSourceRGBA(state->stroke); + if (preserve) { hasShadow() ? shadow(cairo_stroke_preserve)