mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 13:07:26 +01:00
devicescale: Bug fix: the active window can't be passed to ReleaseDC
This commit is contained in:
parent
02a2fc2d44
commit
11d23bafa9
@ -145,7 +145,6 @@ func getFromLogPixelSx() float64 {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
defer releaseDC(0, dc)
|
|
||||||
|
|
||||||
// Note that GetDeviceCaps with LOGPIXELSX always returns a same value for any monitors
|
// Note that GetDeviceCaps with LOGPIXELSX always returns a same value for any monitors
|
||||||
// even if multiple monitors are used.
|
// even if multiple monitors are used.
|
||||||
@ -154,6 +153,10 @@ func getFromLogPixelSx() float64 {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := releaseDC(0, dc); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
return float64(dpi) / 96
|
return float64(dpi) / 96
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,9 +176,9 @@ func impl() float64 {
|
|||||||
}
|
}
|
||||||
// The window is not initialized yet when w == 0.
|
// The window is not initialized yet when w == 0.
|
||||||
if w == 0 {
|
if w == 0 {
|
||||||
|
// TODO: Use the primary monitor instead.
|
||||||
return getFromLogPixelSx()
|
return getFromLogPixelSx()
|
||||||
}
|
}
|
||||||
defer releaseDC(0, w)
|
|
||||||
|
|
||||||
m, err := monitorFromWindow(w, monitorDefaultToNearest)
|
m, err := monitorFromWindow(w, monitorDefaultToNearest)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user