mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +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 {
|
||||
return cached
|
||||
}
|
||||
scale := videoModeScaleUncached(m, monitorX, monitorY)
|
||||
|
||||
scale := videoModeScaleUncached(m)
|
||||
videoModeScaleCache[cacheKey] = scale
|
||||
return scale
|
||||
}
|
||||
|
||||
// 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.
|
||||
// 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
|
||||
}
|
||||
|
||||
monitorX, monitorY := m.GetPos()
|
||||
|
||||
for _, crtc := range res.Crtcs[:res.NumCrtcs] {
|
||||
info, err := randr.GetCrtcInfo(xconn, crtc, res.ConfigTimestamp).Reply()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user