mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
internal/glfwwin: remove unused members (a monitor size)
This commit is contained in:
parent
d577cc5e7d
commit
3a6b707b29
@ -727,10 +727,8 @@ var (
|
||||
|
||||
procChoosePixelFormat = gdi32.NewProc("ChoosePixelFormat")
|
||||
procCreateBitmap = gdi32.NewProc("CreateBitmap")
|
||||
procCreateDCW = gdi32.NewProc("CreateDCW")
|
||||
procCreateDIBSection = gdi32.NewProc("CreateDIBSection")
|
||||
procCreateRectRgn = gdi32.NewProc("CreateRectRgn")
|
||||
procDeleteDC = gdi32.NewProc("DeleteDC")
|
||||
procDeleteObject = gdi32.NewProc("DeleteObject")
|
||||
procDescribePixelFormat = gdi32.NewProc("DescribePixelFormat")
|
||||
procGetDeviceCaps = gdi32.NewProc("GetDeviceCaps")
|
||||
@ -945,44 +943,6 @@ func _CreateBitmap(nWidth int32, nHeight int32, nPlanes uint32, nBitCount uint32
|
||||
return _HBITMAP(r), nil
|
||||
}
|
||||
|
||||
func _CreateDCW(driver string, device string, port string, pdm *_DEVMODEW) (_HDC, error) {
|
||||
var lpszDriver *uint16
|
||||
if driver != "" {
|
||||
var err error
|
||||
lpszDriver, err = windows.UTF16PtrFromString(driver)
|
||||
if err != nil {
|
||||
panic("glfwwin: driver must not include a NUL character")
|
||||
}
|
||||
}
|
||||
|
||||
var lpszDevice *uint16
|
||||
if device != "" {
|
||||
var err error
|
||||
lpszDevice, err = windows.UTF16PtrFromString(device)
|
||||
if err != nil {
|
||||
panic("glfwwin: device must not include a NUL character")
|
||||
}
|
||||
}
|
||||
|
||||
var lpszPort *uint16
|
||||
if port != "" {
|
||||
var err error
|
||||
lpszPort, err = windows.UTF16PtrFromString(port)
|
||||
if err != nil {
|
||||
panic("glfwwin: port must not include a NUL character")
|
||||
}
|
||||
}
|
||||
|
||||
r, _, e := procCreateDCW.Call(uintptr(unsafe.Pointer(lpszDriver)), uintptr(unsafe.Pointer(lpszDevice)), uintptr(unsafe.Pointer(lpszPort)), uintptr(unsafe.Pointer(pdm)))
|
||||
runtime.KeepAlive(lpszDriver)
|
||||
runtime.KeepAlive(lpszDevice)
|
||||
runtime.KeepAlive(lpszPort)
|
||||
if _HDC(r) == 0 {
|
||||
return 0, fmt.Errorf("glfwwin: CreateDCW failed: %w", e)
|
||||
}
|
||||
return _HDC(r), nil
|
||||
}
|
||||
|
||||
func _CreateDIBSection(hdc _HDC, pbmi *_BITMAPV5HEADER, usage uint32, hSection windows.Handle, offset uint32) (_HBITMAP, *byte, error) {
|
||||
// pbmi is originally *BITMAPINFO.
|
||||
var bits *byte
|
||||
@ -1062,14 +1022,6 @@ func _DestroyWindow(hWnd windows.HWND) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func _DeleteDC(hdc _HDC) error {
|
||||
r, _, e := procDeleteDC.Call(uintptr(hdc))
|
||||
if int32(r) == 0 {
|
||||
return fmt.Errorf("glfwwin: DeleteDC failed: %w", e)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func _DeleteObject(ho _HGDIOBJ) error {
|
||||
r, _, e := procDeleteObject.Call(uintptr(ho))
|
||||
if int32(r) == 0 {
|
||||
|
@ -220,9 +220,6 @@ type Window struct {
|
||||
type Monitor struct {
|
||||
name string
|
||||
|
||||
widthMM int
|
||||
heightMM int
|
||||
|
||||
window *Window
|
||||
|
||||
modes []*VidMode
|
||||
|
@ -240,12 +240,7 @@ func (m *Monitor) GetWorkarea() (xpos, ypos, width, height int, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (m *Monitor) GetPhysicalSize() (widthMM, heightMM int, err error) {
|
||||
if !_glfw.initialized {
|
||||
return 0, 0, NotInitialized
|
||||
}
|
||||
return m.widthMM, m.heightMM, nil
|
||||
}
|
||||
// GetPhysicalSize is not implemented.
|
||||
|
||||
func (m *Monitor) GetContentScale() (xscale, yscale float32, err error) {
|
||||
if !_glfw.initialized {
|
||||
|
@ -58,26 +58,8 @@ func createMonitor(adapter *_DISPLAY_DEVICEW, display *_DISPLAY_DEVICEW) (*Monit
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
var widthMM, heightMM int
|
||||
dc, err := _CreateDCW("DISPLAY", adapterDeviceName, "", nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _IsWindows8Point1OrGreater() {
|
||||
widthMM = int(_GetDeviceCaps(dc, _HORZSIZE))
|
||||
heightMM = int(_GetDeviceCaps(dc, _VERTSIZE))
|
||||
} else {
|
||||
widthMM = int(float64(dm.dmPelsWidth) * 25.4 / float64(_GetDeviceCaps(dc, _LOGPIXELSX)))
|
||||
heightMM = int(float64(dm.dmPelsHeight) * 25.4 / float64(_GetDeviceCaps(dc, _LOGPIXELSY)))
|
||||
}
|
||||
if err := _DeleteDC(dc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
monitor := &Monitor{
|
||||
name: name,
|
||||
widthMM: widthMM,
|
||||
heightMM: heightMM,
|
||||
name: name,
|
||||
}
|
||||
|
||||
if adapter.StateFlags&_DISPLAY_DEVICE_MODESPRUNED != 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user