mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/uidriver/glfw: Refactoring
This commit is contained in:
parent
422387c7cd
commit
263276c5ab
@ -51,13 +51,14 @@ func videoModeScale(m *glfw.Monitor) float64 {
|
|||||||
if cached, ok := videoModeScaleCache[cacheKey]; ok {
|
if cached, ok := videoModeScaleCache[cacheKey]; ok {
|
||||||
return cached
|
return cached
|
||||||
}
|
}
|
||||||
scale := videoModeScaleUncached(m, monitorX, monitorY)
|
|
||||||
|
scale := videoModeScaleUncached(m)
|
||||||
videoModeScaleCache[cacheKey] = scale
|
videoModeScaleCache[cacheKey] = scale
|
||||||
return scale
|
return scale
|
||||||
}
|
}
|
||||||
|
|
||||||
// videoModeScaleUncached must be called from the main thread.
|
// videoModeScaleUncached must be called from the main thread.
|
||||||
func videoModeScaleUncached(m *glfw.Monitor, monitorX, monitorY int) float64 {
|
func videoModeScaleUncached(m *glfw.Monitor) float64 {
|
||||||
// TODO: if glfw/glfw#1961 gets fixed, this function may need revising.
|
// TODO: if glfw/glfw#1961 gets fixed, this function may need revising.
|
||||||
// In case GLFW decides to switch to returning logical pixels, we can just return 1.
|
// In case GLFW decides to switch to returning logical pixels, we can just return 1.
|
||||||
|
|
||||||
@ -87,6 +88,8 @@ func videoModeScaleUncached(m *glfw.Monitor, monitorX, monitorY int) float64 {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
monitorX, monitorY := m.GetPos()
|
||||||
|
|
||||||
for _, crtc := range res.Crtcs[:res.NumCrtcs] {
|
for _, crtc := range res.Crtcs[:res.NumCrtcs] {
|
||||||
info, err := randr.GetCrtcInfo(xconn, crtc, res.ConfigTimestamp).Reply()
|
info, err := randr.GetCrtcInfo(xconn, crtc, res.ConfigTimestamp).Reply()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user