Browse Source

fix review findings

af/merge-core
Anton Firszov 8 years ago
parent
commit
723daaeee7
  1. 4
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  2. 12
      src/ImageSharp/ImageFrame{TPixel}.cs
  3. 4
      tests/ImageSharp.Benchmarks/Samplers/Glow.cs

4
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -104,7 +104,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
var image = new Image<TPixel>(this.configuration, this.infoHeader.Width, this.infoHeader.Height);
Buffer2D<TPixel> pixels = image.Frames.RootFrame.PixelBuffer;
Buffer2D<TPixel> pixels = image.GetRootFramePixelBuffer();
switch (this.infoHeader.Compression)
{
@ -580,7 +580,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp
this.stream.Read(palette, 0, colorMapSize);
}
// TODO: ReSharper tells this expression is always true, looks like he's pretty right about it:
// TODO: ReSharper tells this expression is always false, looks like he's pretty right about it:
if (this.infoHeader.Width > int.MaxValue || this.infoHeader.Height > int.MaxValue)
{
throw new ArgumentOutOfRangeException(

12
src/ImageSharp/ImageFrame{TPixel}.cs

@ -210,18 +210,6 @@ namespace SixLabors.ImageSharp
return ref this.PixelBuffer[x, y];
}
/// <summary>
/// Locks the image providing access to the pixels.
/// <remarks>
/// It is imperative that the accessor is correctly disposed off after use.
/// </remarks>
/// </summary>
/// <returns>The <see cref="Buffer2D{TPixel}"/></returns>
internal Buffer2D<TPixel> Lock()
{
return this.PixelBuffer;
}
/// <summary>
/// Copies the pixels to a <see cref="Buffer2D{TPixel}"/> of the same size.
/// </summary>

4
tests/ImageSharp.Benchmarks/Samplers/Glow.cs

@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Benchmarks
}
internal class GlowProcessorParallel<TPixel> : ImageProcessor<TPixel>
where TPixel : struct, IPixel<TPixel>
where TPixel : struct, IPixel<TPixel>
{
/// <summary>
/// Initializes a new instance of the <see cref="GlowProcessorParallel{TPixel}" /> class.
@ -103,8 +103,8 @@ namespace SixLabors.ImageSharp.Benchmarks
int width = maxX - minX;
using (IBuffer<TPixel> rowColors = Configuration.Default.MemoryAllocator.Allocate<TPixel>(width))
using (Buffer2D<TPixel> sourcePixels = source.Lock())
{
Buffer2D<TPixel> sourcePixels = source.PixelBuffer;
rowColors.GetSpan().Fill(glowColor);
Parallel.For(

Loading…
Cancel
Save