fixes buffer size and adds pixel size to paint event
This commit is contained in:
parent
230943d425
commit
50485a28d3
7 changed files with 20 additions and 8 deletions
|
@ -1345,11 +1345,19 @@ bool WebContents::IsOffScreen() const {
|
|||
|
||||
void WebContents::OnPaint(const gfx::Rect& dirty_rect,
|
||||
const gfx::Size& bitmap_size,
|
||||
const int pixel_size,
|
||||
void* bitmap_pixels) {
|
||||
v8::MaybeLocal<v8::Object> buffer = node::Buffer::New(
|
||||
isolate(), reinterpret_cast<char*>(bitmap_pixels), sizeof(bitmap_pixels));
|
||||
isolate(), reinterpret_cast<char*>(bitmap_pixels),
|
||||
pixel_size * dirty_rect.width() * dirty_rect.height());
|
||||
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate());
|
||||
dict.Set("width", bitmap_size.width());
|
||||
dict.Set("height", bitmap_size.height());
|
||||
dict.Set("pixel", pixel_size);
|
||||
|
||||
if (!buffer.IsEmpty())
|
||||
Emit("paint", dirty_rect, buffer.ToLocalChecked(), bitmap_size);
|
||||
Emit("paint", dirty_rect, buffer.ToLocalChecked(), dict);
|
||||
}
|
||||
|
||||
void WebContents::StartPainting() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue