mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/devicescale: Fallback to simpler logic when trying to get DPI from monitor and failing (#1600)
Closes #1612
This commit is contained in:
parent
ab1eb1a0dd
commit
ea0645492e
@ -242,13 +242,15 @@ func impl(x, y int) float64 {
|
|||||||
// do this with Cgo. Use MonitorFromRect instead.
|
// do this with Cgo. Use MonitorFromRect instead.
|
||||||
m, err := monitorFromRect(&lprc, monitorDefaultToNearest)
|
m, err := monitorFromRect(&lprc, monitorDefaultToNearest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
// monitorFromRect can fail in some environments (#1612)
|
||||||
|
return getFromLogPixelSx()
|
||||||
}
|
}
|
||||||
|
|
||||||
dpiX := uint32(0)
|
dpiX := uint32(0)
|
||||||
dpiY := uint32(0) // Passing dpiY is needed even though this is not used, or GetDpiForMonitor returns an error.
|
dpiY := uint32(0) // Passing dpiY is needed even though this is not used, or GetDpiForMonitor returns an error.
|
||||||
if err := getDpiForMonitor(m, mdtEffectiveDpi, &dpiX, &dpiY); err != nil {
|
if err := getDpiForMonitor(m, mdtEffectiveDpi, &dpiX, &dpiY); err != nil {
|
||||||
panic(err)
|
// getDpiForMonitor can fail in some environments (#1612)
|
||||||
|
return getFromLogPixelSx()
|
||||||
}
|
}
|
||||||
runtime.KeepAlive(dpiY)
|
runtime.KeepAlive(dpiY)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user