From 7cc254efb18804df3fd4873107ef9dab6d63da85 Mon Sep 17 00:00:00 2001 From: Scott Williams Date: Tue, 5 Sep 2017 21:23:44 +0100 Subject: [PATCH] fix stylecop issues --- .../Processors/FillProcessor.cs | 2 +- src/ImageSharp/Helpers/ImageExtensions.cs | 2 -- .../Image/ImageFrame.LoadPixelData.cs | 2 -- src/ImageSharp/Image/Image{TPixel}.cs | 32 +++++++++---------- src/ImageSharp/Image/PixelAccessor{TPixel}.cs | 1 + .../Processors/Transforms/ResizeProcessor.cs | 6 ++-- 6 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/ImageSharp.Drawing/Processors/FillProcessor.cs b/src/ImageSharp.Drawing/Processors/FillProcessor.cs index 3c0883d66..c6f11891b 100644 --- a/src/ImageSharp.Drawing/Processors/FillProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/FillProcessor.cs @@ -65,7 +65,7 @@ namespace SixLabors.ImageSharp.Drawing.Processors } int width = maxX - minX; - + using (var amount = new Buffer(width)) using (BrushApplicator applicator = this.brush.CreateApplicator(source, sourceRectangle, this.options)) { diff --git a/src/ImageSharp/Helpers/ImageExtensions.cs b/src/ImageSharp/Helpers/ImageExtensions.cs index 9f3d29332..dbf2e34a4 100644 --- a/src/ImageSharp/Helpers/ImageExtensions.cs +++ b/src/ImageSharp/Helpers/ImageExtensions.cs @@ -18,7 +18,6 @@ namespace SixLabors.ImageSharp.Helpers /// public static partial class ImageExtensions { - /// /// Gets the bounds of the image. /// @@ -58,6 +57,5 @@ namespace SixLabors.ImageSharp.Helpers public static Size Size(this ImageFrame source) where TPixel : struct, IPixel => new Size(source.Width, source.Height); - } } diff --git a/src/ImageSharp/Image/ImageFrame.LoadPixelData.cs b/src/ImageSharp/Image/ImageFrame.LoadPixelData.cs index 3f63b9c64..aecd9bba9 100644 --- a/src/ImageSharp/Image/ImageFrame.LoadPixelData.cs +++ b/src/ImageSharp/Image/ImageFrame.LoadPixelData.cs @@ -20,7 +20,6 @@ namespace SixLabors.ImageSharp /// /// Create a new instance of the class from the given byte array in format. /// - /// The config for the decoder. /// The byte array containing image data. /// The width of the final image. /// The height of the final image. @@ -33,7 +32,6 @@ namespace SixLabors.ImageSharp /// /// Create a new instance of the class from the raw data. /// - /// The config for the decoder. /// The Span containing the image Pixel data. /// The width of the final image. /// The height of the final image. diff --git a/src/ImageSharp/Image/Image{TPixel}.cs b/src/ImageSharp/Image/Image{TPixel}.cs index ce8a6f721..cfd28f05d 100644 --- a/src/ImageSharp/Image/Image{TPixel}.cs +++ b/src/ImageSharp/Image/Image{TPixel}.cs @@ -67,22 +67,6 @@ namespace SixLabors.ImageSharp { } - /// - /// Switches the buffers used by the image and the pixelSource meaning that the Image will "own" the buffer from the pixelSource and the pixelSource will now own the Images buffer. - /// - /// The pixel source. - internal void SwapPixelsBuffers(Image pixelSource) - { - Guard.NotNull(pixelSource, nameof(pixelSource)); - - int newHeight = pixelSource.Height; - - for (int i = 0; i < this.Frames.Count; i++) - { - this.Frames[i].SwapPixelsBuffers(pixelSource.Frames[i]); - } - } - /// /// Initializes a new instance of the class /// with the height and the width of the image. @@ -229,5 +213,21 @@ namespace SixLabors.ImageSharp this.Frames[i].Dispose(); } } + + /// + /// Switches the buffers used by the image and the pixelSource meaning that the Image will "own" the buffer from the pixelSource and the pixelSource will now own the Images buffer. + /// + /// The pixel source. + internal void SwapPixelsBuffers(Image pixelSource) + { + Guard.NotNull(pixelSource, nameof(pixelSource)); + + int newHeight = pixelSource.Height; + + for (int i = 0; i < this.Frames.Count; i++) + { + this.Frames[i].SwapPixelsBuffers(pixelSource.Frames[i]); + } + } } } \ No newline at end of file diff --git a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs index 006429a17..bb5f427df 100644 --- a/src/ImageSharp/Image/PixelAccessor{TPixel}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TPixel}.cs @@ -418,6 +418,7 @@ namespace SixLabors.ImageSharp /// Sets the pixel buffer in an unsafe manor this should not be used unless you know what its doing!!! /// /// The pixel buffer + /// if set to true then this instance ownes the buffer and thus should dispose of it afterwards. private void SetPixelBufferUnsafe(Buffer2D pixels, bool ownedBuffer) { this.PixelBuffer = pixels; diff --git a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs index d50a68def..98b8e1289 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. using System; +using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Threading.Tasks; @@ -52,12 +53,13 @@ namespace SixLabors.ImageSharp.Processing.Processors /// protected override Image CreateDestination(Image source, Rectangle sourceRectangle) { - var config = source.Configuration(); + Configuration config = source.Configuration(); + // We will always be creating the clone even for mutate because thats the way this base processor works // ------------ // For resize we know we are going to populate every pixel with fresh data and we want a different target size so // let's manually clone an empty set of images at the correct target and then have the base class processs them in turn. - var frames = source.Frames.Select(x => new ImageFrame(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders + IEnumerable> frames = source.Frames.Select(x => new ImageFrame(this.Width, this.Height, x.MetaData.Clone())); // this will create places holders var image = new Image(config, this.Width, this.Height, source.MetaData.Clone(), frames); // base the place holder images in to prevet a extra frame being added return image;