Browse Source

Sanitation [skip ci]

Former-commit-id: 75afdcee89a077e71c541a528bef5dc73ba8841b
Former-commit-id: cbc78b6631dedb8c625b755d9cb7d7eb6be62d95
Former-commit-id: 442f01311ac24030e7a3894bfe0a431ea5fde2ee
af/merge-core
James Jackson-South 10 years ago
parent
commit
ba6b44156d
  1. 0
      .editorconfig
  2. 6
      src/ImageProcessorCore/Samplers/ImageSamplerExtensions.cs

0
.editorconfig

6
src/ImageProcessorCore/Samplers/ImageSamplerExtensions.cs

@ -40,6 +40,9 @@ namespace ImageProcessorCore.Samplers
/// <returns>The <see cref="Image"/></returns>
public static Image Crop(this Image source, int width, int height, Rectangle sourceRectangle, ProgressEventHandler progressHandler = null)
{
Guard.MustBeGreaterThan(width, 0, nameof(width));
Guard.MustBeGreaterThan(height, 0, nameof(height));
if (sourceRectangle.Width < width || sourceRectangle.Height < height)
{
// If the source rectangle is smaller than the target perform a
@ -183,6 +186,9 @@ namespace ImageProcessorCore.Samplers
height = source.Height * width / source.Width;
}
Guard.MustBeGreaterThan(width, 0, nameof(width));
Guard.MustBeGreaterThan(height, 0, nameof(height));
Resize processor = new Resize(sampler) { Compand = compand };
processor.OnProgress += progressHandler;

Loading…
Cancel
Save