Browse Source

Grab image surface data

v1.x
Tj Holowaychuk 14 years ago
parent
commit
5badfa1e64
  1. 6
      src/CanvasRenderingContext2d.cc

6
src/CanvasRenderingContext2d.cc

@ -407,11 +407,9 @@ Context2d::DrawImage(const Arguments &args) {
double dw = args[3]->IsNumber() ? args[3]->NumberValue() : img->width;
double dh = args[4]->IsNumber() ? args[4]->NumberValue() : img->height;
// Draw
uint8_t *src = cairo_image_surface_get_data(img->surface());
cairo_t *ctx = context->context();
cairo_save(ctx);
cairo_set_source_surface(ctx, img->surface(), dx, dy);
cairo_paint(ctx);
cairo_restore(ctx);
return Undefined();
}

Loading…
Cancel
Save