Pārlūkot izejas kodu

Define processing.CalcCropSize globally

DarthSim 2 nedēļas atpakaļ
vecāks
revīzija
a0942b2368
1 mainītis faili ar 3 papildinājumiem un 3 dzēšanām
  1. 3 3
      processing/prepare.go

+ 3 - 3
processing/prepare.go

@@ -54,7 +54,7 @@ func angleFlip(img *vips.Image, autoRotate bool) (int, bool) {
 }
 
 // CalcCropSize calculates the crop size based on the original size and crop scale.
-func (c *Context) CalcCropSize(orig int, crop float64) int {
+func CalcCropSize(orig int, crop float64) int {
 	switch {
 	case crop == 0.0:
 		return 0
@@ -267,8 +267,8 @@ func (c *Context) limitScale(widthToScale, heightToScale int, po *options.Proces
 func (c *Context) CalcParams() {
 	c.SrcWidth, c.SrcHeight, c.Angle, c.Flip = ExtractGeometry(c.Img, c.PO.Rotate, c.PO.AutoRotate)
 
-	c.CropWidth = c.CalcCropSize(c.SrcWidth, c.PO.Crop.Width)
-	c.CropHeight = c.CalcCropSize(c.SrcHeight, c.PO.Crop.Height)
+	c.CropWidth = CalcCropSize(c.SrcWidth, c.PO.Crop.Width)
+	c.CropHeight = CalcCropSize(c.SrcHeight, c.PO.Crop.Height)
 
 	widthToScale := imath.MinNonZero(c.CropWidth, c.SrcWidth)
 	heightToScale := imath.MinNonZero(c.CropHeight, c.SrcHeight)