ui: Change how to calc framebuffer scale

This commit is contained in:
Hajime Hoshi 2016-02-27 01:53:02 +09:00
parent 8069c980c3
commit 651d803107

View File

@ -120,6 +120,9 @@ func (u *userInterface) start(width, height, scale int, title string) error {
if 0 < mw { if 0 < mw {
dpi := float64(v.Width) * 25.4 / float64(mw) dpi := float64(v.Width) * 25.4 / float64(mw)
u.deviceScaleFactor = dpi / 96 u.deviceScaleFactor = dpi / 96
if u.deviceScaleFactor < 1 {
u.deviceScaleFactor = 1
}
} }
u.setScreenSize(width, height, scale) u.setScreenSize(width, height, scale)
@ -134,7 +137,7 @@ func (u *userInterface) start(width, height, scale int, title string) error {
} }
func (u *userInterface) windowScale() int { func (u *userInterface) windowScale() int {
return int(float64(u.scale) * u.deviceScaleFactor) return u.scale * int(u.deviceScaleFactor)
} }
func (u *userInterface) actualScale() int { func (u *userInterface) actualScale() int {