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) {
HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(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<Value>
Context2d::Stroke(const Arguments &args) {
HandleScope scope;
Context2d *context = ObjectWrap::Unwrap<Context2d>(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)

4
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();

Loading…
Cancel
Save