summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAlexander Neumann <alexander.neumann@picos-software.com>2019-10-28 14:20:23 +0100
committerGitHub <noreply@github.com>2019-10-28 14:20:23 +0100
commit8f89dd763401f6f71bb0862436904a09c1a7c01b (patch)
tree1e1cbba5a31803d3317d401772f5364b3e9ab6e5
parentMerge pull request #636 from zx2c4-forks/jd/icondpiabuse (diff)
parentMetafile, DPI: Cleanup (diff)
downloadwireguard-windows-8f89dd763401f6f71bb0862436904a09c1a7c01b.tar.xz
wireguard-windows-8f89dd763401f6f71bb0862436904a09c1a7c01b.zip
Merge pull request #639 from rozmansi/pending/dpi-fun2-cleanup
Metafile, DPI: Cleanup
-rw-r--r--metafile.go5
-rw-r--r--util.go18
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 {
diff --git a/util.go b/util.go
index 54360a68..365e33cd 100644
--- a/util.go
+++ b/util.go
@@ -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)),
- }
-}