diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
index e73774a0c..0ae8d26b6 100644
--- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
+++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs
@@ -322,7 +322,7 @@ namespace ImageSharp.Formats
image = currentFrame;
- RestoreToBackground(image);
+ this.RestoreToBackground(image);
this.decodedImage.Frames.Add(currentFrame);
}
diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
index be125f4b1..d9983eb29 100644
--- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
+++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs
@@ -209,7 +209,6 @@ namespace ImageSharp.Formats
this.bytes = Bytes.Create();
// TODO: This looks like it could be static.
-
for (int i = 0; i < MaxTc + 1; i++)
{
for (int j = 0; j < MaxTh + 1; j++)
@@ -229,7 +228,8 @@ namespace ImageSharp.Formats
/// The stream, where the image should be.
/// Whether to decode metadata only.
public void Decode(Image image, Stream stream, bool configOnly)
- where TColor : struct, IPackedPixel where TPacked : struct
+ where TColor : struct, IPackedPixel
+ where TPacked : struct
{
this.inputStream = stream;
@@ -287,7 +287,7 @@ namespace ImageSharp.Formats
break;
}
- if (JpegConstants.Markers.RST0 <= marker && marker <= JpegConstants.Markers.RST7)
+ if (marker >= JpegConstants.Markers.RST0 && marker <= JpegConstants.Markers.RST7)
{
// Figures B.2 and B.16 of the specification suggest that restart markers should
// only occur between Entropy Coded Segments and not after the final ECS.
@@ -336,7 +336,11 @@ namespace ImageSharp.Formats
{
this.Skip(remaining);
}
- else this.ProcessDqt(remaining);
+ else
+ {
+ this.ProcessDqt(remaining);
+ }
+
break;
case JpegConstants.Markers.SOS:
if (configOnly)
diff --git a/src/ImageSharp/Image/PixelAccessor.cs b/src/ImageSharp/Image/PixelAccessor.cs
index 712fe2023..39534dbde 100644
--- a/src/ImageSharp/Image/PixelAccessor.cs
+++ b/src/ImageSharp/Image/PixelAccessor.cs
@@ -120,20 +120,6 @@ namespace ImageSharp
}
}
- [Conditional("DEBUG")]
- private void CheckCoordinates(int x, int y)
- {
- if (x < 0 || x >= this.Width)
- {
- throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
- }
-
- if (y < 0 || y >= this.Height)
- {
- throw new ArgumentOutOfRangeException(nameof(y), y, $"{y} is outwith the image bounds.");
- }
- }
-
///
/// Copies a block of pixels at the specified position.
///
@@ -433,5 +419,19 @@ namespace ImageSharp
{
return this.pixelsBase + ((targetY * this.Width) * Unsafe.SizeOf());
}
+
+ [Conditional("DEBUG")]
+ private void CheckCoordinates(int x, int y)
+ {
+ if (x < 0 || x >= this.Width)
+ {
+ throw new ArgumentOutOfRangeException(nameof(x), x, $"{x} is outwith the image bounds.");
+ }
+
+ if (y < 0 || y >= this.Height)
+ {
+ throw new ArgumentOutOfRangeException(nameof(y), y, $"{y} is outwith the image bounds.");
+ }
+ }
}
}
\ No newline at end of file