Merge pull request #6164 from MaxWhere/master

beginFrameSubscription bugfix and improvement
This commit is contained in:
Cheng Zhao 2016-06-26 02:39:59 +00:00 committed by GitHub
commit 3d2ad0080d
7 changed files with 94 additions and 31 deletions

View file

@ -919,12 +919,14 @@ For the `mouseWheel` event, the `event` object also have following properties:
* `hasPreciseScrollingDeltas` Boolean
* `canScroll` Boolean
### `webContents.beginFrameSubscription(callback)`
### `webContents.beginFrameSubscription([onlyDirty ,]callback)`
* `onlyDirty` Boolean
* `callback` Function
Begin subscribing for presentation events and captured frames, the `callback`
will be called with `callback(frameBuffer)` when there is a presentation event.
will be called with `callback(frameBuffer, dirtyRect)` when there is a
presentation event.
The `frameBuffer` is a `Buffer` that contains raw pixel data. On most machines,
the pixel data is effectively stored in 32bit BGRA format, but the actual
@ -932,6 +934,11 @@ representation depends on the endianness of the processor (most modern
processors are little-endian, on machines with big-endian processors the data
is in 32bit ARGB format).
The `dirtyRect` is an object with `x, y, width, height` properties that
describes which part of the page was repainted. If `onlyDirty` is set to
`true`, `frameBuffer` will only contain the repainted area. `onlyDirty`
defaults to `false`.
### `webContents.endFrameSubscription()`
End subscribing for frame presentation events.