Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
This commit is contained in:
Josh Soref
2021-09-20 16:54:29 +05:45
committed by Phil Davis
parent 806d224ed7
commit 55667a3ab3
87 changed files with 192 additions and 192 deletions
+3 -3
View File
@@ -11,12 +11,12 @@ import (
)
const (
_resolutionSeperator = "x"
_resolutionSeparator = "x"
)
// ParseResolution returns an image.Rectangle representing the resolution given as a string
func ParseResolution(s string) (image.Rectangle, error) {
parts := strings.Split(s, _resolutionSeperator)
parts := strings.Split(s, _resolutionSeparator)
if len(parts) != 2 {
return image.Rectangle{}, fmt.Errorf("failed to parse resolution: %s. Expected format <width>x<height>", s)
}
@@ -78,7 +78,7 @@ func (rs Resolutions) ClosestMatch(requested image.Rectangle, sourceSize image.R
}
// Convert diff to positive value
// Multiplying by -1 is safe since we aren't getting postive numbers here
// Multiplying by -1 is safe since we aren't getting positive numbers here
// because of the check above
absDiff := diff * -1
if absDiff < minDiff {