diff options
author | Simon Rozman <simon@rozman.si> | 2019-10-26 21:36:12 +0200 |
---|---|---|
committer | Simon Rozman <simon@rozman.si> | 2019-10-26 21:36:12 +0200 |
commit | 2ac7e13325faadce4f18d09ea86c494de117b4b2 (patch) | |
tree | bd06f0d9ed481f43231f8f9fb51bd5e03914ab24 | |
parent | Merge pull request #635 from zx2c4-forks/scrolltable (diff) | |
download | wireguard-windows-2ac7e13325faadce4f18d09ea86c494de117b4b2.tar.xz wireguard-windows-2ac7e13325faadce4f18d09ea86c494de117b4b2.zip |
Metafile, DPI: Cleanup
Metafile is the only place we support non-uniform DPI. Not to bloat the
API the non-uniform DPI helpers were removed.
See-also: #638
Signed-off-by: Simon Rozman <simon@rozman.si>
-rw-r--r-- | metafile.go | 5 | ||||
-rw-r--r-- | util.go | 18 |
2 files changed, 4 insertions, 19 deletions
diff --git a/metafile.go b/metafile.go index 2c6a992e..b2d087f3 100644 --- a/metafile.go +++ b/metafile.go @@ -107,7 +107,10 @@ func (mf *Metafile) ensureFinished() error { // Size returns image size in 1/96" units. func (mf *Metafile) Size() Size { - return SizeTo96DPI2(mf.size, mf.dpi) + return Size{ + Width: scaleInt(mf.size.Width, 96.0/float64(mf.dpi.Width)), + Height: scaleInt(mf.size.Height, 96.0/float64(mf.dpi.Height)), + } } func (mf *Metafile) draw(hdc win.HDC, location Point) error { @@ -598,21 +598,3 @@ func scaleSize(value Size, scale float64) Size { Height: scaleInt(value.Height, scale), } } - -// SizeFrom96DPI2 converts from 1/96" units to native pixels. This version assumes different -// horizontal and vertical DPI. -func SizeFrom96DPI2(value Size, dpi Size) Size { - return Size{ - Width: scaleInt(value.Width, float64(dpi.Width)/96.0), - Height: scaleInt(value.Height, float64(dpi.Height)/96.0), - } -} - -// SizeTo96DPI2 converts from native pixels to 1/96" units. This version assumes different -// horizontal and vertical DPI. -func SizeTo96DPI2(value Size, dpi Size) Size { - return Size{ - Width: scaleInt(value.Width, 96.0/float64(dpi.Width)), - Height: scaleInt(value.Height, 96.0/float64(dpi.Height)), - } -} |