📝 Offscreen Rendering
This commit is contained in:
parent
69b0a358f3
commit
20ca6b4a55
1 changed files with 4 additions and 2 deletions
|
@ -14,7 +14,7 @@ performance loss.
|
||||||
|
|
||||||
**Note:** An offscreen window is always created as a [Frameless Window](../api/frameless-window.md).
|
**Note:** An offscreen window is always created as a [Frameless Window](../api/frameless-window.md).
|
||||||
|
|
||||||
## Two modes of rendering
|
## Rendering Modes
|
||||||
|
|
||||||
### GPU accelerated
|
### GPU accelerated
|
||||||
|
|
||||||
|
@ -35,17 +35,19 @@ To enable this mode GPU acceleration has to be disabled by calling the
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
``` javascript
|
``` javascript
|
||||||
const {app, BrowserWindow} = require('electron')
|
const { app, BrowserWindow } = require('electron')
|
||||||
|
|
||||||
app.disableHardwareAcceleration()
|
app.disableHardwareAcceleration()
|
||||||
|
|
||||||
let win
|
let win
|
||||||
|
|
||||||
app.once('ready', () => {
|
app.once('ready', () => {
|
||||||
win = new BrowserWindow({
|
win = new BrowserWindow({
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
offscreen: true
|
offscreen: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
win.loadURL('http://github.com')
|
win.loadURL('http://github.com')
|
||||||
win.webContents.on('paint', (event, dirty, image) => {
|
win.webContents.on('paint', (event, dirty, image) => {
|
||||||
// updateBitmap(dirty, image.getBitmap())
|
// updateBitmap(dirty, image.getBitmap())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue