diff --git a/src/ImageSharp/Image/ImageBase{TColor}.cs b/src/ImageSharp/Image/ImageBase{TColor}.cs index 0cedb7aaa..e6c14f0e9 100644 --- a/src/ImageSharp/Image/ImageBase{TColor}.cs +++ b/src/ImageSharp/Image/ImageBase{TColor}.cs @@ -163,7 +163,7 @@ namespace ImageSharp int newWidth = pixelSource.Width; int newHeight = pixelSource.Height; - // push my memory into the accessor (which in turn unpins the old puffer ready for the images use) + // Push my memory into the accessor (which in turn unpins the old puffer ready for the images use) TColor[] newPixels = pixelSource.ReturnCurrentPixelsAndReplaceThemInternally(this.Width, this.Height, this.pixelBuffer, true); this.Width = newWidth; this.Height = newHeight; diff --git a/src/ImageSharp/Image/PixelAccessor{TColor}.cs b/src/ImageSharp/Image/PixelAccessor{TColor}.cs index 58cff55c8..f37ba7496 100644 --- a/src/ImageSharp/Image/PixelAccessor{TColor}.cs +++ b/src/ImageSharp/Image/PixelAccessor{TColor}.cs @@ -45,9 +45,9 @@ namespace ImageSharp private bool isDisposed; /// - /// The pixels data + /// The pixel buffer /// - private TColor[] pixels; + private TColor[] pixelBuffer; /// /// Initializes a new instance of the class. @@ -66,7 +66,7 @@ namespace ImageSharp /// /// Initializes a new instance of the class. /// - /// Gets the width of the image represented by the pixel buffer. + /// The width of the image represented by the pixel buffer. /// The height of the image represented by the pixel buffer. /// The pixel buffer. public PixelAccessor(int width, int height, TColor[] pixels) @@ -77,7 +77,7 @@ namespace ImageSharp /// /// Initializes a new instance of the class. /// - /// Gets the width of the image represented by the pixel buffer. + /// The width of the image represented by the pixel buffer. /// The height of the image represented by the pixel buffer. public PixelAccessor(int width, int height) : this(width, height, PixelPool.RentPixels(width * height), true) @@ -87,10 +87,10 @@ namespace ImageSharp /// /// Initializes a new instance of the class. /// - /// Gets the width of the image represented by the pixel buffer. + /// The width of the image represented by the pixel buffer. /// The height of the image represented by the pixel buffer. /// The pixel buffer. - /// if set to true then the TColor[] is from the PixelPool{TColor} thus should be returned once disposed. + /// if set to true then the is from the thus should be returned once disposed. private PixelAccessor(int width, int height, TColor[] pixels, bool pooledMemory) { Guard.NotNull(pixels, nameof(pixels)); @@ -116,11 +116,8 @@ namespace ImageSharp } /// - /// Gets a value indicating whether [pooled memory]. + /// Gets a value indicating whether the current pixel buffer is from a pooled source. /// - /// - /// true if [pooled memory]; otherwise, false. - /// public bool PooledMemory { get; private set; } /// @@ -259,8 +256,8 @@ namespace ImageSharp if (this.PooledMemory) { - PixelPool.ReturnPixels(this.pixels); - this.pixels = null; + PixelPool.ReturnPixels(this.pixelBuffer); + this.pixelBuffer = null; } } @@ -273,17 +270,17 @@ namespace ImageSharp } /// - /// Sets the pixel buffer in an unsafe manor this should not be used unless you know what its doing!!! + /// Sets the pixel buffer in an unsafe manner. This should not be used unless you know what its doing!!! /// /// The width. /// The height. /// The pixels. - /// if set to true [pooled memory]. + /// If set to true this indicates that the pixel buffer is from a pooled source. /// Returns the old pixel data thats has gust been replaced. - /// If PixelAccessor.PooledMemory is true then caller is responsible for ensuring PixelPool.ReturnPixels() is called. + /// If is true then caller is responsible for ensuring is called. internal TColor[] ReturnCurrentPixelsAndReplaceThemInternally(int width, int height, TColor[] pixels, bool pooledMemory) { - TColor[] oldPixels = this.pixels; + TColor[] oldPixels = this.pixelBuffer; this.SetPixelBufferUnsafe(width, height, pixels, pooledMemory); return oldPixels; } @@ -518,10 +515,10 @@ namespace ImageSharp /// The width. /// The height. /// The pixels. - /// if set to true [pooled memory]. + /// If set to true this indicates that the pixel buffer is from a pooled source. private void SetPixelBufferUnsafe(int width, int height, TColor[] pixels, bool pooledMemory) { - this.pixels = pixels; + this.pixelBuffer = pixels; this.PooledMemory = pooledMemory; this.Width = width; this.Height = height; @@ -538,7 +535,7 @@ namespace ImageSharp // unpin any old pixels just incase this.UnPinPixels(); - this.pixelsHandle = GCHandle.Alloc(this.pixels, GCHandleType.Pinned); + this.pixelsHandle = GCHandle.Alloc(this.pixelBuffer, GCHandleType.Pinned); this.dataPointer = this.pixelsHandle.AddrOfPinnedObject(); this.pixelsBase = (byte*)this.dataPointer.ToPointer(); } @@ -639,13 +636,13 @@ namespace ImageSharp int width = Math.Min(area.Width, this.Width - x); if (width < 1) { - throw new ArgumentOutOfRangeException(nameof(width), width, $"Invalid area size specified."); + throw new ArgumentOutOfRangeException(nameof(width), width, "Invalid area size specified."); } int height = Math.Min(area.Height, this.Height - y); if (height < 1) { - throw new ArgumentOutOfRangeException(nameof(height), height, $"Invalid area size specified."); + throw new ArgumentOutOfRangeException(nameof(height), height, "Invalid area size specified."); } }