From 723daaeee75d4168e6cc1ef9c248877e89975e92 Mon Sep 17 00:00:00 2001 From: Anton Firszov Date: Sun, 17 Jun 2018 13:00:11 +0200 Subject: [PATCH] fix review findings --- src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs | 4 ++-- src/ImageSharp/ImageFrame{TPixel}.cs | 12 ------------ tests/ImageSharp.Benchmarks/Samplers/Glow.cs | 4 ++-- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index a8378e096..f5121a1a3 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -104,7 +104,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp var image = new Image(this.configuration, this.infoHeader.Width, this.infoHeader.Height); - Buffer2D pixels = image.Frames.RootFrame.PixelBuffer; + Buffer2D 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( diff --git a/src/ImageSharp/ImageFrame{TPixel}.cs b/src/ImageSharp/ImageFrame{TPixel}.cs index 7fd60949b..bd86b7dee 100644 --- a/src/ImageSharp/ImageFrame{TPixel}.cs +++ b/src/ImageSharp/ImageFrame{TPixel}.cs @@ -210,18 +210,6 @@ namespace SixLabors.ImageSharp return ref this.PixelBuffer[x, y]; } - /// - /// Locks the image providing access to the pixels. - /// - /// It is imperative that the accessor is correctly disposed off after use. - /// - /// - /// The - internal Buffer2D Lock() - { - return this.PixelBuffer; - } - /// /// Copies the pixels to a of the same size. /// diff --git a/tests/ImageSharp.Benchmarks/Samplers/Glow.cs b/tests/ImageSharp.Benchmarks/Samplers/Glow.cs index edfc2f878..ce17481c4 100644 --- a/tests/ImageSharp.Benchmarks/Samplers/Glow.cs +++ b/tests/ImageSharp.Benchmarks/Samplers/Glow.cs @@ -52,7 +52,7 @@ namespace SixLabors.ImageSharp.Benchmarks } internal class GlowProcessorParallel : ImageProcessor - where TPixel : struct, IPixel + where TPixel : struct, IPixel { /// /// Initializes a new instance of the class. @@ -103,8 +103,8 @@ namespace SixLabors.ImageSharp.Benchmarks int width = maxX - minX; using (IBuffer rowColors = Configuration.Default.MemoryAllocator.Allocate(width)) - using (Buffer2D sourcePixels = source.Lock()) { + Buffer2D sourcePixels = source.PixelBuffer; rowColors.GetSpan().Fill(glowColor); Parallel.For(