瀏覽代碼

Go <1.10 doesn't have math.Round, ook

DarthSim 6 年之前
父節點
當前提交
27c1ef068a
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      process.go

+ 2 - 2
process.go

@@ -201,8 +201,8 @@ func calcCrop(width, height int, po processingOptions) (left, top int) {
 	}
 
 	if po.Gravity.Type == gravityFocusPoint {
-		pointX := int(math.Round(float64(width) * po.Gravity.X))
-		pointY := int(math.Round(float64(height) * po.Gravity.Y))
+		pointX := int(float64(width) * po.Gravity.X)
+		pointY := int(float64(height) * po.Gravity.Y)
 
 		left = maxInt(0, minInt(pointX-po.Width/2, width-po.Width))
 		top = maxInt(0, minInt(pointY-po.Height/2, height-po.Height))