docs: Use app.disableHardwareAcceleration() instead of --disable-gpu
The --disable-gpu switch does not work when passed with `appendSwitch`.
This commit is contained in:
parent
c8b544ee1f
commit
63c34f3dcf
2 changed files with 6 additions and 39 deletions
|
@ -25,22 +25,17 @@ mode that WebGL and 3D CSS animations are supported.
|
|||
|
||||
This mode uses a software output device for rendering in the CPU, so the frame
|
||||
generation is much faster, thus this mode is preferred over the GPU accelerated
|
||||
one. To enable this mode GPU acceleration has to be disabled like this:
|
||||
one.
|
||||
|
||||
``` javascript
|
||||
const {app} = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('disable-gpu')
|
||||
app.commandLine.appendSwitch('disable-gpu-compositing')
|
||||
```
|
||||
To enable this mode GPU acceleration has to be disabled by calling the
|
||||
[`app.disableHardwareAcceleration()`][disablehardwareacceleration] API.
|
||||
|
||||
## Usage
|
||||
|
||||
``` javascript
|
||||
const {app, BrowserWindow} = require('electron')
|
||||
|
||||
app.commandLine.appendSwitch('disable-gpu')
|
||||
app.commandLine.appendSwitch('disable-gpu-compositing')
|
||||
app.disableHardwareAcceleration()
|
||||
|
||||
let win = new BrowserWindow({
|
||||
width: 800,
|
||||
|
@ -57,3 +52,5 @@ win.webContents.on('paint', (event, dirty, data) => {
|
|||
// updateBitmap(dirty, data)
|
||||
})
|
||||
```
|
||||
|
||||
[disablehardwareacceleration]: ../api/app.md#appdisablehardwareacceleration
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue