devicescale: Rename function

This commit is contained in:
Hajime Hoshi 2018-10-04 01:28:53 +09:00
parent 10b49bb0a3
commit 1807a3f530
5 changed files with 5 additions and 5 deletions

View File

@ -22,7 +22,7 @@ var (
m sync.Mutex m sync.Mutex
) )
func DeviceScale() float64 { func Get() float64 {
m.Lock() m.Lock()
defer m.Unlock() defer m.Unlock()
return impl() return impl()

View File

@ -31,7 +31,7 @@ func (d *deviceScale) Update() {
func (d *deviceScale) Get() float64 { func (d *deviceScale) Get() float64 {
// As devicescale.DeviceScale accesses OS API, not call this too often. // As devicescale.DeviceScale accesses OS API, not call this too often.
if d.val == 0 || d.frame-d.lastUpdated > 30 { if d.val == 0 || d.frame-d.lastUpdated > 30 {
d.val = devicescale.DeviceScale() d.val = devicescale.Get()
d.lastUpdated = d.frame d.lastUpdated = d.frame
} }
return d.val return d.val

View File

@ -84,7 +84,7 @@ func deviceScale() float64 {
defer deviceScaleM.Unlock() defer deviceScaleM.Unlock()
if deviceScaleVal == 0 { if deviceScaleVal == 0 {
deviceScaleVal = devicescale.DeviceScale() deviceScaleVal = devicescale.Get()
} }
return deviceScaleVal return deviceScaleVal
} }

View File

@ -23,7 +23,7 @@ import (
) )
func glfwScale() float64 { func glfwScale() float64 {
return devicescale.DeviceScale() return devicescale.Get()
} }
func adjustWindowPosition(x, y int) (int, int) { func adjustWindowPosition(x, y int) (int, int) {

2
run.go
View File

@ -528,7 +528,7 @@ func SetWindowIcon(iconImages []image.Image) {
// //
// DeviceScaleFactor is concurrent-safe. // DeviceScaleFactor is concurrent-safe.
func DeviceScaleFactor() float64 { func DeviceScaleFactor() float64 {
return devicescale.DeviceScale() return devicescale.Get()
} }
// IsVsyncEnabled returns a boolean value indicating whether // IsVsyncEnabled returns a boolean value indicating whether