mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
all: make unit.Converter concrete and rename to Metric
An interface for scaling dp and sp is overkill, at least for all current uses. Make it a concrete struct type, and rename it to the shorter and more precise Metric. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -19,6 +19,7 @@ import (
|
||||
syscall "golang.org/x/sys/windows"
|
||||
|
||||
"gioui.org/app/internal/windows"
|
||||
"gioui.org/unit"
|
||||
|
||||
"gioui.org/f32"
|
||||
"gioui.org/io/key"
|
||||
@@ -377,7 +378,7 @@ func (w *window) draw(sync bool) {
|
||||
X: w.width,
|
||||
Y: w.height,
|
||||
},
|
||||
Config: &cfg,
|
||||
Metric: cfg,
|
||||
},
|
||||
Sync: sync,
|
||||
})
|
||||
@@ -586,12 +587,12 @@ func convertKeyCode(code uintptr) (string, bool) {
|
||||
return r, true
|
||||
}
|
||||
|
||||
func configForDC() config {
|
||||
func configForDC() unit.Metric {
|
||||
dpi := windows.GetSystemDPI()
|
||||
const inchPrDp = 1.0 / 96.0
|
||||
ppdp := float32(dpi) * inchPrDp
|
||||
return config{
|
||||
pxPerDp: ppdp,
|
||||
pxPerSp: ppdp,
|
||||
return unit.Metric{
|
||||
PxPerDp: ppdp,
|
||||
PxPerSp: ppdp,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user