use any and min builtins

This commit is contained in:
Will Norris 2025-04-28 18:11:56 -07:00
parent 07c1c27092
commit f2bc67185d
2 changed files with 6 additions and 12 deletions

View file

@ -212,14 +212,8 @@ func cropParams(m image.Image, opt Options) image.Rectangle {
}
// bottom right coordinate of crop
x1 := x0 + w
if x1 > imgW {
x1 = imgW
}
y1 := y0 + h
if y1 > imgH {
y1 = imgH
}
x1 := min(x0+w, imgW)
y1 := min(y0+h, imgH)
return image.Rect(x0, y0, x1, y1)
}