Browse Source

Build fixes and feedback

pull/2269/head
James Jackson-South 3 years ago
parent
commit
30a245a388
  1. 2
      src/ImageSharp/Formats/Jpeg/JpegEncoder.cs
  2. 6
      src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs

2
src/ImageSharp/Formats/Jpeg/JpegEncoder.cs

@ -15,7 +15,7 @@ public sealed class JpegEncoder : ImageEncoder
/// <summary> /// <summary>
/// Gets the quality, that will be used to encode the image. Quality /// Gets the quality, that will be used to encode the image. Quality
/// index must be between 0 and 100 (compression from max to min). /// index must be between 1 and 100 (compression from max to min).
/// Defaults to <value>75</value>. /// Defaults to <value>75</value>.
/// </summary> /// </summary>
/// <exception cref="ArgumentException">Quality factor must be in [1..100] range.</exception> /// <exception cref="ArgumentException">Quality factor must be in [1..100] range.</exception>

6
src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs

@ -1,6 +1,7 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Six Labors Split License. // Licensed under the Six Labors Split License.
using System.Diagnostics;
using SixLabors.ImageSharp.Memory; using SixLabors.ImageSharp.Memory;
using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.PixelFormats;
@ -86,7 +87,8 @@ public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy
for (int pos = 0; pos < totalNumberOfRows; pos++) for (int pos = 0; pos < totalNumberOfRows; pos++)
{ {
int subPos = pos % denom; Debug.Assert(denom > 0, "Denominator must be greater than zero.");
int subPos = (int)((uint)pos % (uint)denom);
if (subPos < num) if (subPos < num)
{ {
yield return GetRow(pos); yield return GetRow(pos);
@ -137,7 +139,7 @@ public class DefaultPixelSamplingStrategy : IPixelSamplingStrategy
for (int pos = 0; pos < totalNumberOfRows; pos++) for (int pos = 0; pos < totalNumberOfRows; pos++)
{ {
Debug.Assert(denom > 0); Debug.Assert(denom > 0, "Denominator must be greater than zero.");
int subPos = (int)((uint)pos % (uint)denom); int subPos = (int)((uint)pos % (uint)denom);
if (subPos < num) if (subPos < num)
{ {

Loading…
Cancel
Save