diff --git a/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs b/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs index 6c46f2d6b..95cb55d36 100644 --- a/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs +++ b/src/ImageProcessorCore/Formats/Bmp/BmpEncoderCore.cs @@ -5,7 +5,6 @@ namespace ImageProcessorCore.Formats { - using System; using System.IO; using IO; @@ -21,7 +20,7 @@ namespace ImageProcessorCore.Formats private BmpBitsPerPixel bmpBitsPerPixel; /// - /// The amount to pad each row by. + /// The amount to pad each row by. /// private int padding; @@ -44,7 +43,7 @@ namespace ImageProcessorCore.Formats // Cast to int will get the bytes per pixel short bpp = (short)(8 * (int)bitsPerPixel); - int bytesPerLine = 4 * ((image.Width * bpp + 31) / 32); + int bytesPerLine = 4 * (((image.Width * bpp) + 31) / 32); this.padding = bytesPerLine - (image.Width * (int)bitsPerPixel); // Do not use IDisposable pattern here as we want to preserve the stream. @@ -121,9 +120,8 @@ namespace ImageProcessorCore.Formats /// Writes the pixel data to the binary stream. /// /// The pixel format. - /// The packed format. long, float./// - /// The containing the stream to write to. - /// + /// The packed format. long, float. + /// The containing the stream to write to. /// /// The containing pixel data. /// @@ -133,14 +131,14 @@ namespace ImageProcessorCore.Formats { using (IPixelAccessor pixels = image.Lock()) { - switch (bmpBitsPerPixel) + switch (this.bmpBitsPerPixel) { case BmpBitsPerPixel.Pixel32: - this.Write32bit(writer, pixels); + this.Write32Bit(writer, pixels); break; case BmpBitsPerPixel.Pixel24: - this.Write24bit(writer, pixels); + this.Write24Bit(writer, pixels); break; } } @@ -153,7 +151,7 @@ namespace ImageProcessorCore.Formats /// The packed format. long, float. /// The containing the stream to write to. /// The containing pixel data. - private void Write32bit(EndianBinaryWriter writer, IPixelAccessor pixels) + private void Write32Bit(EndianBinaryWriter writer, IPixelAccessor pixels) where T : IPackedVector where TP : struct { @@ -180,7 +178,7 @@ namespace ImageProcessorCore.Formats /// The pixel format. /// The packed format. long, float./// The containing the stream to write to. /// The containing pixel data. - private void Write24bit(EndianBinaryWriter writer, IPixelAccessor pixels) + private void Write24Bit(EndianBinaryWriter writer, IPixelAccessor pixels) where T : IPackedVector where TP : struct {