Browse Source

Merge branch 'master' of github.com:LearnBoost/node-canvas

v1.x
Tj Holowaychuk 14 years ago
parent
commit
28cd7532b0
  1. 5
      src/Canvas.cc

5
src/Canvas.cc

@ -294,6 +294,7 @@ Canvas::Canvas(int w, int h): ObjectWrap() {
width = w;
height = h;
_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
V8::AdjustAmountOfExternalAllocatedMemory(4 * width * height);
}
/*
@ -311,9 +312,11 @@ Canvas::~Canvas() {
void
Canvas::resurface(Handle<Object> canvas) {
// Re-surface
int old_width = cairo_image_surface_get_width(_surface);
int old_height = cairo_image_surface_get_height(_surface);
cairo_surface_destroy(_surface);
_surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
V8::AdjustAmountOfExternalAllocatedMemory(-4 * width * height);
V8::AdjustAmountOfExternalAllocatedMemory(4 * (width * height - old_width * old_height));
// Reset context
Handle<Value> context = canvas->Get(String::New("context"));

Loading…
Cancel
Save