aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Drawing/DrawingUtils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Drawing/DrawingUtils.cs')
-rw-r--r--MediaBrowser.Model/Drawing/DrawingUtils.cs12
1 files changed, 5 insertions, 7 deletions
diff --git a/MediaBrowser.Model/Drawing/DrawingUtils.cs b/MediaBrowser.Model/Drawing/DrawingUtils.cs
index 8fb9bdc0a..c2a144f81 100644
--- a/MediaBrowser.Model/Drawing/DrawingUtils.cs
+++ b/MediaBrowser.Model/Drawing/DrawingUtils.cs
@@ -58,7 +58,7 @@ namespace MediaBrowser.Model.Drawing
}
/// <summary>
- /// Resizes to fill box.
+ /// Scale down to fill box.
/// Returns original size if both width and height are null or zero.
/// </summary>
/// <param name="size">The original size object.</param>
@@ -71,9 +71,8 @@ namespace MediaBrowser.Model.Drawing
int? fillHeight)
{
// Return original size if input is invalid.
- if (
- (fillWidth == null && fillHeight == null)
- || (fillWidth == 0 || fillHeight == 0))
+ if ((fillWidth == null || fillWidth == 0)
+ && (fillHeight == null || fillHeight == 0))
{
return size;
}
@@ -89,9 +88,8 @@ namespace MediaBrowser.Model.Drawing
}
double widthRatio = (double)size.Width / (double)fillWidth;
- double heightRatio = (double)size.Height / (double)fillHeight!;
- // min()
- double scaleRatio = widthRatio > heightRatio ? heightRatio : widthRatio;
+ double heightRatio = (double)size.Height / (double)fillHeight;
+ double scaleRatio = Math.Min(widthRatio, heightRatio);
// Clamp to current size.
if (scaleRatio < 1)