From 7f56dc825e723c555d4f9ce9ee0ddf2acfa65010 Mon Sep 17 00:00:00 2001 From: Tj Holowaychuk Date: Mon, 8 Nov 2010 10:53:59 -0800 Subject: [PATCH] Utilizing new stroke/fill --- src/CanvasRenderingContext2d.cc | 23 ++++------------------- src/CanvasRenderingContext2d.h | 4 ++-- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/CanvasRenderingContext2d.cc b/src/CanvasRenderingContext2d.cc index 94bf62b..3ffb312 100644 --- a/src/CanvasRenderingContext2d.cc +++ b/src/CanvasRenderingContext2d.cc @@ -776,9 +776,7 @@ Handle Context2d::Fill(const Arguments &args) { HandleScope scope; Context2d *context = ObjectWrap::Unwrap(args.This()); - cairo_t *ctx = context->getContext(); - SET_SOURCE(context->state->fill); - cairo_fill_preserve(ctx); + context->fill(true); return Undefined(); } @@ -790,20 +788,7 @@ Handle 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()) { - cairo_stroke_preserve(ctx); - return Undefined(); - } - - context->shadowStart(); - cairo_stroke_preserve(ctx); - - context->shadowApply(); - cairo_stroke_preserve(ctx); - + context->stroke(true); return Undefined(); } @@ -1157,7 +1142,7 @@ Context2d::Arc(const Arguments &args) { */ void -Context2d::fill() { +Context2d::fill(bool preserve) { setSourceRGBA(state->fill); hasShadow() ? shadow(cairo_fill) @@ -1169,7 +1154,7 @@ Context2d::fill() { */ void -Context2d::stroke() { +Context2d::stroke(bool preserve) { setSourceRGBA(state->stroke); hasShadow() ? shadow(cairo_stroke) diff --git a/src/CanvasRenderingContext2d.h b/src/CanvasRenderingContext2d.h index c54b816..131f501 100644 --- a/src/CanvasRenderingContext2d.h +++ b/src/CanvasRenderingContext2d.h @@ -110,8 +110,8 @@ class Context2d: public node::ObjectWrap { void restorePath(); void saveState(); void restoreState(); - void fill(); - void stroke(); + void fill(bool preserve = false); + void stroke(bool preserve = false); void save(); void restore();