Browse Source

Utilizing new stroke/fill

v1.x
Tj Holowaychuk 14 years ago
parent
commit
7f56dc825e
  1. 23
      src/CanvasRenderingContext2d.cc
  2. 4
      src/CanvasRenderingContext2d.h

23
src/CanvasRenderingContext2d.cc

@ -776,9 +776,7 @@ Handle<Value>
Context2d::Fill(const Arguments &args) { Context2d::Fill(const Arguments &args) {
HandleScope scope; HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->getContext(); context->fill(true);
SET_SOURCE(context->state->fill);
cairo_fill_preserve(ctx);
return Undefined(); return Undefined();
} }
@ -790,20 +788,7 @@ Handle<Value>
Context2d::Stroke(const Arguments &args) { Context2d::Stroke(const Arguments &args) {
HandleScope scope; HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This()); Context2d *context = ObjectWrap::Unwrap<Context2d>(args.This());
cairo_t *ctx = context->getContext(); context->stroke(true);
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);
return Undefined(); return Undefined();
} }
@ -1157,7 +1142,7 @@ Context2d::Arc(const Arguments &args) {
*/ */
void void
Context2d::fill() { Context2d::fill(bool preserve) {
setSourceRGBA(state->fill); setSourceRGBA(state->fill);
hasShadow() hasShadow()
? shadow(cairo_fill) ? shadow(cairo_fill)
@ -1169,7 +1154,7 @@ Context2d::fill() {
*/ */
void void
Context2d::stroke() { Context2d::stroke(bool preserve) {
setSourceRGBA(state->stroke); setSourceRGBA(state->stroke);
hasShadow() hasShadow()
? shadow(cairo_stroke) ? shadow(cairo_stroke)

4
src/CanvasRenderingContext2d.h

@ -110,8 +110,8 @@ class Context2d: public node::ObjectWrap {
void restorePath(); void restorePath();
void saveState(); void saveState();
void restoreState(); void restoreState();
void fill(); void fill(bool preserve = false);
void stroke(); void stroke(bool preserve = false);
void save(); void save();
void restore(); void restore();

Loading…
Cancel
Save