chore: fix function names

Signed-off-by: stayweek <jiangtengtao@outlook.com>
This commit is contained in:
stayweek 2024-04-01 17:22:43 +08:00
parent f0a26cf58e
commit 91db921f11
2 changed files with 3 additions and 3 deletions

View file

@ -43,7 +43,7 @@ type imagingResizer struct {
func (r imagingResizer) Resize(img image.Image, width, height uint) image.Image {
// See https://github.com/gohugoio/hugo/issues/7955#issuecomment-861710681
scaleX, scaleY := calcFactorsNfnt(width, height, float64(img.Bounds().Dx()), float64(img.Bounds().Dy()))
scaleX, scaleY := Calculates(width, height, float64(img.Bounds().Dx()), float64(img.Bounds().Dy()))
if width == 0 {
width = uint(math.Ceil(float64(img.Bounds().Dx()) / scaleX))
}
@ -83,7 +83,7 @@ func (p *ImageProcessor) smartCrop(img image.Image, width, height int, filter gi
// Calculates scaling factors using old and new image dimensions.
// Code borrowed from https://github.com/nfnt/resize/blob/83c6a9932646f83e3267f353373d47347b6036b2/resize.go#L593
func calcFactorsNfnt(width, height uint, oldWidth, oldHeight float64) (scaleX, scaleY float64) {
func Calculates(width, height uint, oldWidth, oldHeight float64) (scaleX, scaleY float64) {
if width == 0 {
if height == 0 {
scaleX = 1.0

View file

@ -67,7 +67,7 @@ var builtinFuncsOnce struct {
v map[string]reflect.Value
}
// builtinFuncsOnce lazily computes & caches the builtinFuncs map.
// builtinFuncs lazily computes & caches the builtinFuncs map.
// TODO: revert this back to a global map once golang.org/issue/2559 is fixed.
func builtinFuncs() map[string]reflect.Value {
builtinFuncsOnce.Do(func() {