Pass SkBitmap directly

This commit is contained in:
Cheng Zhao 2016-08-04 13:22:19 +09:00
parent 530fcc8de1
commit 64334fd40b
7 changed files with 16 additions and 34 deletions

View file

@ -1338,19 +1338,14 @@ bool WebContents::IsOffScreen() const {
}
void WebContents::OnPaint(const gfx::Rect& dirty_rect,
const gfx::Size& bitmap_size,
int pixel_size,
void* bitmap_pixels) {
const SkBitmap& bitmap) {
v8::MaybeLocal<v8::Object> buffer = node::Buffer::Copy(
isolate(), reinterpret_cast<char*>(bitmap_pixels),
pixel_size * bitmap_size.width() * bitmap_size.height());
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate());
dict.Set("width", bitmap_size.width());
dict.Set("height", bitmap_size.height());
if (!buffer.IsEmpty())
Emit("paint", dirty_rect, buffer.ToLocalChecked(), dict);
isolate(),
reinterpret_cast<char*>(bitmap.getPixels()), bitmap.getSize());
if (!buffer.IsEmpty()) {
Emit("paint", dirty_rect, buffer.ToLocalChecked(),
gfx::Size(bitmap.width(), bitmap.height()));
}
}
void WebContents::StartPainting() {