mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-24 20:36:24 +02:00
use any and min builtins
This commit is contained in:
parent
07c1c27092
commit
f2bc67185d
2 changed files with 6 additions and 12 deletions
10
transform.go
10
transform.go
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue