fix canvas issue when gpu is disabled
This commit is contained in:
parent
7803b6d737
commit
1be0ec296d
4 changed files with 10 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ window.READ_ONLY = false
|
|||
window.GRIDWIDTH = 10
|
||||
|
||||
|
||||
window.ELECTRON_NOGPU = false
|
||||
window.CANVAS_FRAMERATE = parseFloat(ENV.framerate || 60)
|
||||
window.CANVAS_SCALING = parseFloat(ENV.forceHdpi) || ( ENV.hdpi ? window.devicePixelRatio : 1 )
|
||||
window.INITIALZOOM = ENV.zoom ? parseFloat(ENV.zoom) : 1
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class Canvas extends Widget {
|
|||
this.canvas = DOM.get(this.container, 'canvas')[0]
|
||||
|
||||
this.ctx = this.canvas.getContext('2d',{
|
||||
desynchronized: true,
|
||||
desynchronized: ELECTRON_NOGPU ? false : true,
|
||||
lowLatency: true,
|
||||
alpha: true,
|
||||
preserveDrawingBuffer: true // avoid flickering
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ if (settings.read('noVsync') || (!settings.cli && settings.read('argv')['disable
|
|||
|
||||
if (settings.read('noGpu') || (!settings.cli && settings.read('argv')['disable-gpu'])) {
|
||||
app.disableHardwareAcceleration()
|
||||
app._noGpu = true
|
||||
}
|
||||
|
||||
if (settings.read('forceGpu') || (!settings.cli && settings.read('argv')['force-gpu'])) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
var path = require('path'),
|
||||
{BrowserWindow, dialog, shell, screen} = require('electron'),
|
||||
shortcut = require('electron-localshortcut'),
|
||||
app = require('./electron-app'),
|
||||
settings = require('./settings'),
|
||||
theme = require('./theme'),
|
||||
screenSize = screen.getPrimaryDisplay().size
|
||||
|
|
@ -28,12 +29,17 @@ module.exports = function(options={}) {
|
|||
|
||||
window.once('ready-to-show', ()=>{
|
||||
window.show()
|
||||
|
||||
})
|
||||
|
||||
window.webContents.once('page-title-updated', ()=>{
|
||||
if (options.fullscreen) {
|
||||
window.webContents.sendInputEvent({keyCode: 'F11', type: 'keyDown'})
|
||||
}
|
||||
if (app._noGpu) {
|
||||
window.webContents.executeJavaScript(`
|
||||
window.ELECTRON_NOGPU = true
|
||||
`)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue