Browse Source

Merge branch 'mortenbock-master' into dev

Former-commit-id: f58313ce79b551e584ccf5d1375a1c742520024d
pull/17/head
James South 13 years ago
parent
commit
f8605177c1
  1. 8
      src/ImageProcessor/Processors/Resize.cs

8
src/ImageProcessor/Processors/Resize.cs

@ -367,10 +367,12 @@ namespace ImageProcessor.Processors
// Constrain the image to fit the maximum possible height or width. // Constrain the image to fit the maximum possible height or width.
if (resizeMode == ResizeMode.Max) if (resizeMode == ResizeMode.Max)
{ {
if (sourceWidth > width || sourceHeight > height) //If either is 0, we don't need to figure out orientation
if (width > 0 && height > 0)
{ {
double ratio = Math.Abs(height / width); //integers must be cast to doubles to get needed precision
double sourceRatio = Math.Abs(sourceHeight / sourceWidth); double ratio = (double)height / width;
double sourceRatio = (double)sourceHeight / sourceWidth;
if (sourceRatio < ratio) if (sourceRatio < ratio)
{ {

Loading…
Cancel
Save