aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui.go19
1 files changed, 18 insertions, 1 deletions
diff --git a/ui.go b/ui.go
index 88b35b3..1ee281d 100644
--- a/ui.go
+++ b/ui.go
@@ -357,10 +357,27 @@ func compressorWidget() {
canvas := g.GetCanvas()
if compressorTexture != nil {
winWidth, winHeight := g.GetAvailableRegion()
+
+ bounds := compressorImage.Bounds()
+ imWidth := float32(bounds.Dx())
+ imHeight := float32(bounds.Dy())
+
+ var ratio, xratio, yratio float32
+ xratio = winWidth / imWidth
+ yratio = winHeight / imHeight
+ if xratio < yratio {
+ ratio = xratio
+ } else {
+ ratio = yratio
+ }
+
+ x := int(imWidth * ratio)
+ y := int(imHeight * ratio)
+
canvas.AddImage(
compressorTexture,
image.Pt(0, 250),
- image.Pt(int(winWidth), int(winHeight)),
+ image.Pt(x, y),
)
}
}