Browse Source

resetting surface on resize

v1.x
Tj Holowaychuk 14 years ago
parent
commit
9a49ddb484
  1. 2
      src/canvas.cc
  2. 2
      src/canvas.h

2
src/canvas.cc

@ -75,6 +75,7 @@ Canvas::SetWidth(Local<String> prop, Local<Value> val, const AccessorInfo &info)
if (val->IsNumber()) {
Canvas *canvas = ObjectWrap::Unwrap<Canvas>(info.This());
canvas->width = val->Uint32Value();
canvas->resetSurface();
}
}
@ -97,6 +98,7 @@ Canvas::SetHeight(Local<String> prop, Local<Value> val, const AccessorInfo &info
if (val->IsNumber()) {
Canvas *canvas = ObjectWrap::Unwrap<Canvas>(info.This());
canvas->height = val->Uint32Value();
canvas->resetSurface();
}
}

2
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;
};

Loading…
Cancel
Save