From 0a911b28b25331186e6672004dbeea4c502b43dc Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 7 Jan 2018 14:51:25 +0900 Subject: [PATCH] ui: Remove unneeded variable deviceScale --- internal/ui/ui_js.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/internal/ui/ui_js.go b/internal/ui/ui_js.go index 4838ca7d0..e9e9ebdf5 100644 --- a/internal/ui/ui_js.go +++ b/internal/ui/ui_js.go @@ -36,7 +36,6 @@ type userInterface struct { fullscreen bool runnableInBackground bool - deviceScale float64 sizeChanged bool windowFocus bool } @@ -116,7 +115,12 @@ func (u *userInterface) getScale() float64 { } func (u *userInterface) actualScreenScale() float64 { - return u.getScale() * u.deviceScale + // CSS imageRendering property seems useful to enlarge the screen, + // but doesn't work in some cases (#306): + // * Chrome just after restoring the lost context + // * Safari + // Let's use the devicePixelRatio as it is here. + return u.getScale() * devicescale.DeviceScale() } func (u *userInterface) update(g GraphicsContext) error { @@ -373,13 +377,6 @@ func (u *userInterface) setScreenSize(width, height int, scale float64, fullscre } func (u *userInterface) updateScreenSize() { - // CSS imageRendering seems useful to enlarge the screen, - // but doesn't work in some cases (#306): - // * Chrome just after restoring the lost context - // * Safari - // Let's use the pixel ratio as it is here. - u.deviceScale = devicescale.DeviceScale() - canvas.Set("width", int(float64(u.width)*u.actualScreenScale())) canvas.Set("height", int(float64(u.height)*u.actualScreenScale())) canvasStyle := canvas.Get("style")