diff --git a/src/canvas.cc b/src/canvas.cc index c13ad17..07bcf33 100644 --- a/src/canvas.cc +++ b/src/canvas.cc @@ -75,6 +75,7 @@ Canvas::SetWidth(Local prop, Local val, const AccessorInfo &info) if (val->IsNumber()) { Canvas *canvas = ObjectWrap::Unwrap(info.This()); canvas->width = val->Uint32Value(); + canvas->resetSurface(); } } @@ -97,6 +98,7 @@ Canvas::SetHeight(Local prop, Local val, const AccessorInfo &info if (val->IsNumber()) { Canvas *canvas = ObjectWrap::Unwrap(info.This()); canvas->height = val->Uint32Value(); + canvas->resetSurface(); } } diff --git a/src/canvas.h b/src/canvas.h index 3f3a082..2648877 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -62,10 +62,10 @@ class Canvas: public node::ObjectWrap { inline cairo_surface_t *getSurface(){ return _surface; } static void blur(cairo_surface_t *surface, int radius); Canvas(int width, int height); + void resetSurface(); private: ~Canvas(); - void resetSurface(); cairo_surface_t *_surface; };