From bedd0a91fb2a2c0c61e05ef1af4322c3a54880cd Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Thu, 30 Apr 2020 19:40:06 +0100 Subject: [PATCH] BufferRegion => Buffer2DRegion --- src/ImageSharp/Formats/Gif/GifDecoderCore.cs | 2 +- .../Jpeg/Components/Block8x8F.ScaledCopyTo.cs | 2 +- src/ImageSharp/Memory/Buffer2DExtensions.cs | 22 ++++++------ ...ufferRegion{T}.cs => Buffer2DRegion{T}.cs} | 36 +++++++++---------- .../DefaultPixelSamplingStrategy.cs | 4 +-- .../ExtensivePixelSamplingStrategy.cs | 2 +- .../Quantization/IPixelSamplingStrategy.cs | 4 +-- .../Quantization/IQuantizer{TPixel}.cs | 4 +-- .../Quantization/OctreeQuantizer{TPixel}.cs | 2 +- .../Quantization/PaletteQuantizer{TPixel}.cs | 2 +- .../Quantization/QuantizerUtilities.cs | 4 +-- .../Quantization/WuQuantizer{TPixel}.cs | 2 +- .../Resize/ResizeProcessor{TPixel}.cs | 2 +- .../Transforms/Resize/ResizeWorker.cs | 4 +-- .../BlockOperations/Block8x8F_CopyTo2x2.cs | 2 +- .../Jpg/Block8x8FTests.CopyToBufferArea.cs | 4 +-- .../Memory/BufferAreaTests.cs | 14 ++++---- .../PixelSamplingStrategyTests.cs | 6 ++-- 18 files changed, 59 insertions(+), 59 deletions(-) rename src/ImageSharp/Memory/{BufferRegion{T}.cs => Buffer2DRegion{T}.cs} (79%) diff --git a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs index ba94851f8..2d8bd319d 100644 --- a/src/ImageSharp/Formats/Gif/GifDecoderCore.cs +++ b/src/ImageSharp/Formats/Gif/GifDecoderCore.cs @@ -543,7 +543,7 @@ namespace SixLabors.ImageSharp.Formats.Gif return; } - BufferRegion pixelRegion = frame.PixelBuffer.GetRegion(this.restoreArea.Value); + Buffer2DRegion pixelRegion = frame.PixelBuffer.GetRegion(this.restoreArea.Value); pixelRegion.Clear(); this.restoreArea = null; diff --git a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopyTo.cs b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopyTo.cs index 2fbc81707..82a013f70 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopyTo.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopyTo.cs @@ -15,7 +15,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components /// Copy block data into the destination color buffer pixel area with the provided horizontal and vertical scale factors. /// [MethodImpl(InliningOptions.ShortMethod)] - public void ScaledCopyTo(in BufferRegion region, int horizontalScale, int verticalScale) + public void ScaledCopyTo(in Buffer2DRegion region, int horizontalScale, int verticalScale) { ref float areaOrigin = ref region.GetReferenceToOrigin(); this.ScaledCopyTo(ref areaOrigin, region.Stride, horizontalScale, verticalScale); diff --git a/src/ImageSharp/Memory/Buffer2DExtensions.cs b/src/ImageSharp/Memory/Buffer2DExtensions.cs index d61ac9087..11c61f56c 100644 --- a/src/ImageSharp/Memory/Buffer2DExtensions.cs +++ b/src/ImageSharp/Memory/Buffer2DExtensions.cs @@ -80,29 +80,29 @@ namespace SixLabors.ImageSharp.Memory } /// - /// Return a to the subarea represented by 'rectangle' + /// Return a to the subregion represented by 'rectangle' /// /// The element type /// The - /// The rectangle subarea - /// The - internal static BufferRegion GetRegion(this Buffer2D buffer, in Rectangle rectangle) + /// The rectangle subregion + /// The + internal static Buffer2DRegion GetRegion(this Buffer2D buffer, Rectangle rectangle) where T : unmanaged => - new BufferRegion(buffer, rectangle); + new Buffer2DRegion(buffer, rectangle); - internal static BufferRegion GetRegion(this Buffer2D buffer, int x, int y, int width, int height) + internal static Buffer2DRegion GetRegion(this Buffer2D buffer, int x, int y, int width, int height) where T : unmanaged => - new BufferRegion(buffer, new Rectangle(x, y, width, height)); + new Buffer2DRegion(buffer, new Rectangle(x, y, width, height)); /// - /// Return a to the whole area of 'buffer' + /// Return a to the whole area of 'buffer' /// /// The element type /// The - /// The - internal static BufferRegion GetRegion(this Buffer2D buffer) + /// The + internal static Buffer2DRegion GetRegion(this Buffer2D buffer) where T : unmanaged => - new BufferRegion(buffer); + new Buffer2DRegion(buffer); /// /// Returns the size of the buffer. diff --git a/src/ImageSharp/Memory/BufferRegion{T}.cs b/src/ImageSharp/Memory/Buffer2DRegion{T}.cs similarity index 79% rename from src/ImageSharp/Memory/BufferRegion{T}.cs rename to src/ImageSharp/Memory/Buffer2DRegion{T}.cs index 901c3217b..b22307a1d 100644 --- a/src/ImageSharp/Memory/BufferRegion{T}.cs +++ b/src/ImageSharp/Memory/Buffer2DRegion{T}.cs @@ -9,16 +9,16 @@ namespace SixLabors.ImageSharp.Memory /// Represents a rectangular region inside a 2D memory buffer (). /// /// The element type. - public readonly struct BufferRegion + public readonly struct Buffer2DRegion where T : unmanaged { /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The . /// The defining a rectangular area within the buffer. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferRegion(Buffer2D buffer, Rectangle rectangle) + public Buffer2DRegion(Buffer2D buffer, Rectangle rectangle) { DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.X, 0, nameof(rectangle)); DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.Y, 0, nameof(rectangle)); @@ -30,11 +30,11 @@ namespace SixLabors.ImageSharp.Memory } /// - /// Initializes a new instance of the struct. + /// Initializes a new instance of the struct. /// /// The . [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferRegion(Buffer2D buffer) + public Buffer2DRegion(Buffer2D buffer) : this(buffer, buffer.FullRectangle()) { } @@ -98,27 +98,27 @@ namespace SixLabors.ImageSharp.Memory } /// - /// Returns a sub-area as . (Similar to .) + /// Returns a subregion as . (Similar to .) /// - /// The x index at the subarea origin. - /// The y index at the subarea origin. - /// The desired width of the subarea. - /// The desired height of the subarea. - /// The subarea + /// The x index at the subregion origin. + /// The y index at the subregion origin. + /// The desired width of the subregion. + /// The desired height of the subregion. + /// The subregion [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferRegion GetSubArea(int x, int y, int width, int height) + public Buffer2DRegion GetSubRegion(int x, int y, int width, int height) { var rectangle = new Rectangle(x, y, width, height); - return this.GetSubArea(rectangle); + return this.GetSubRegion(rectangle); } /// - /// Returns a sub-area as . (Similar to .) + /// Returns a subregion as . (Similar to .) /// - /// The specifying the boundaries of the subarea - /// The subarea + /// The specifying the boundaries of the subregion + /// The subregion [MethodImpl(MethodImplOptions.AggressiveInlining)] - public BufferRegion GetSubArea(Rectangle rectangle) + public Buffer2DRegion GetSubRegion(Rectangle rectangle) { DebugGuard.MustBeLessThanOrEqualTo(rectangle.Width, this.Rectangle.Width, nameof(rectangle)); DebugGuard.MustBeLessThanOrEqualTo(rectangle.Height, this.Rectangle.Height, nameof(rectangle)); @@ -126,7 +126,7 @@ namespace SixLabors.ImageSharp.Memory int x = this.Rectangle.X + rectangle.X; int y = this.Rectangle.Y + rectangle.Y; rectangle = new Rectangle(x, y, rectangle.Width, rectangle.Height); - return new BufferRegion(this.Buffer, rectangle); + return new Buffer2DRegion(this.Buffer, rectangle); } /// diff --git a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs index 660d41bd5..d2bf06bcd 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs @@ -50,7 +50,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization public double MinimumScanRatio { get; } /// - public IEnumerable> EnumeratePixelRegions(Image image) + public IEnumerable> EnumeratePixelRegions(Image image) where TPixel : unmanaged, IPixel { long maximumPixels = Math.Min(this.MaximumPixels, (long)image.Width * image.Height * image.Frames.Count); @@ -95,7 +95,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization } } - BufferRegion GetRow(int pos) + Buffer2DRegion GetRow(int pos) { int frameIdx = pos / image.Height; int y = pos % image.Height; diff --git a/src/ImageSharp/Processing/Processors/Quantization/ExtensivePixelSamplingStrategy.cs b/src/ImageSharp/Processing/Processors/Quantization/ExtensivePixelSamplingStrategy.cs index e2774850a..8ef05640a 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/ExtensivePixelSamplingStrategy.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/ExtensivePixelSamplingStrategy.cs @@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization public class ExtensivePixelSamplingStrategy : IPixelSamplingStrategy { /// - public IEnumerable> EnumeratePixelRegions(Image image) + public IEnumerable> EnumeratePixelRegions(Image image) where TPixel : unmanaged, IPixel { foreach (ImageFrame frame in image.Frames) diff --git a/src/ImageSharp/Processing/Processors/Quantization/IPixelSamplingStrategy.cs b/src/ImageSharp/Processing/Processors/Quantization/IPixelSamplingStrategy.cs index 71b20174d..6c2e3bd88 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/IPixelSamplingStrategy.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/IPixelSamplingStrategy.cs @@ -13,12 +13,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization public interface IPixelSamplingStrategy { /// - /// Enumerates pixel regions within the image as . + /// Enumerates pixel regions within the image as . /// /// The image. /// The pixel type. /// An enumeration of pixel regions. - IEnumerable> EnumeratePixelRegions(Image image) + IEnumerable> EnumeratePixelRegions(Image image) where TPixel : unmanaged, IPixel; } } diff --git a/src/ImageSharp/Processing/Processors/Quantization/IQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/IQuantizer{TPixel}.cs index 0c3c6a83a..26c906f06 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/IQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/IQuantizer{TPixel}.cs @@ -35,8 +35,8 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization /// /// Adds colors to the quantized palette from the given pixel source. /// - /// The of source pixels to register. - void AddPaletteColors(BufferRegion pixelRegion); + /// The of source pixels to register. + void AddPaletteColors(Buffer2DRegion pixelRegion); /// /// Quantizes an image frame and return the resulting output pixels. diff --git a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs index c74e8ef86..7fefda3f1 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs @@ -69,7 +69,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization /// [MethodImpl(InliningOptions.ShortMethod)] - public void AddPaletteColors(BufferRegion pixelRegion) + public void AddPaletteColors(Buffer2DRegion pixelRegion) { Rectangle bounds = pixelRegion.Rectangle; Buffer2D source = pixelRegion.Buffer; diff --git a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs index 44daef84d..82ff572fa 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs @@ -54,7 +54,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization /// [MethodImpl(InliningOptions.ShortMethod)] - public void AddPaletteColors(BufferRegion pixelRegion) + public void AddPaletteColors(Buffer2DRegion pixelRegion) { } diff --git a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs index a3f13e00d..1fe69ea30 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/QuantizerUtilities.cs @@ -53,7 +53,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization Guard.NotNull(source, nameof(source)); var interest = Rectangle.Intersect(source.Bounds(), bounds); - BufferRegion region = source.PixelBuffer.GetRegion(interest); + Buffer2DRegion region = source.PixelBuffer.GetRegion(interest); // Collect the palette. Required before the second pass runs. quantizer.AddPaletteColors(region); @@ -107,7 +107,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization Image image) where TPixel : unmanaged, IPixel { - foreach (BufferRegion region in pixelSamplingStrategy.EnumeratePixelRegions(image)) + foreach (Buffer2DRegion region in pixelSamplingStrategy.EnumeratePixelRegions(image)) { quantizer.AddPaletteColors(region); } diff --git a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs index 3f0822bed..5e086feaa 100644 --- a/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Quantization/WuQuantizer{TPixel}.cs @@ -118,7 +118,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization } /// - public void AddPaletteColors(BufferRegion pixelRegion) + public void AddPaletteColors(Buffer2DRegion pixelRegion) { Rectangle bounds = pixelRegion.Rectangle; Buffer2D source = pixelRegion.Buffer; diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs index 630c88bac..09d95c8ac 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeProcessor{TPixel}.cs @@ -172,7 +172,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms PixelConversionModifiers conversionModifiers = PixelConversionModifiers.Premultiply.ApplyCompanding(compand); - BufferRegion sourceRegion = source.PixelBuffer.GetRegion(sourceRectangle); + Buffer2DRegion sourceRegion = source.PixelBuffer.GetRegion(sourceRectangle); // To reintroduce parallel processing, we would launch multiple workers // for different row intervals of the image. diff --git a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs index 6cdb7934c..96e516e39 100644 --- a/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs +++ b/src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs @@ -29,7 +29,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms private readonly ResizeKernelMap horizontalKernelMap; - private readonly BufferRegion source; + private readonly Buffer2DRegion source; private readonly Rectangle sourceRectangle; @@ -53,7 +53,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Transforms public ResizeWorker( Configuration configuration, - BufferRegion source, + Buffer2DRegion source, PixelConversionModifiers conversionModifiers, ResizeKernelMap horizontalKernelMap, ResizeKernelMap verticalKernelMap, diff --git a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs index 0237c8170..20f3e0d56 100644 --- a/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs +++ b/tests/ImageSharp.Benchmarks/Codecs/Jpeg/BlockOperations/Block8x8F_CopyTo2x2.cs @@ -18,7 +18,7 @@ namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg.BlockOperations private Buffer2D buffer; - private BufferRegion destRegion; + private Buffer2DRegion destRegion; [GlobalSetup] public void Setup() diff --git a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs index 169b9c0fc..169d3dd2d 100644 --- a/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs +++ b/tests/ImageSharp.Tests/Formats/Jpg/Block8x8FTests.CopyToBufferArea.cs @@ -43,7 +43,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg using (Buffer2D buffer = Configuration.Default.MemoryAllocator.Allocate2D(20, 20, AllocationOptions.Clean)) { - BufferRegion region = buffer.GetRegion(5, 10, 8, 8); + Buffer2DRegion region = buffer.GetRegion(5, 10, 8, 8); block.Copy1x1Scale(ref region.GetReferenceToOrigin(), region.Stride); Assert.Equal(block[0, 0], buffer[5, 10]); @@ -71,7 +71,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg using (Buffer2D buffer = Configuration.Default.MemoryAllocator.Allocate2D(100, 100, AllocationOptions.Clean)) { - BufferRegion region = buffer.GetRegion(start.X, start.Y, 8 * horizontalFactor, 8 * verticalFactor); + Buffer2DRegion region = buffer.GetRegion(start.X, start.Y, 8 * horizontalFactor, 8 * verticalFactor); block.ScaledCopyTo(region, horizontalFactor, verticalFactor); for (int y = 0; y < 8 * verticalFactor; y++) diff --git a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs index 81173b456..59f3f5aa0 100644 --- a/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs +++ b/tests/ImageSharp.Tests/Memory/BufferAreaTests.cs @@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Tests.Memory { using Buffer2D buffer = this.memoryAllocator.Allocate2D(10, 20); var rectangle = new Rectangle(3, 2, 5, 6); - var area = new BufferRegion(buffer, rectangle); + var area = new Buffer2DRegion(buffer, rectangle); Assert.Equal(buffer, area.Buffer); Assert.Equal(rectangle, area.Rectangle); @@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Tests.Memory using Buffer2D buffer = this.CreateTestBuffer(20, 30); var r = new Rectangle(rx, ry, 5, 6); - BufferRegion region = buffer.GetRegion(r); + Buffer2DRegion region = buffer.GetRegion(r); int value = region[x, y]; int expected = ((ry + y) * 100) + rx + x; @@ -66,7 +66,7 @@ namespace SixLabors.ImageSharp.Tests.Memory using Buffer2D buffer = this.CreateTestBuffer(20, 30); var r = new Rectangle(rx, ry, w, h); - BufferRegion region = buffer.GetRegion(r); + Buffer2DRegion region = buffer.GetRegion(r); Span span = region.GetRowSpan(y); @@ -85,9 +85,9 @@ namespace SixLabors.ImageSharp.Tests.Memory public void GetSubArea() { using Buffer2D buffer = this.CreateTestBuffer(20, 30); - BufferRegion area0 = buffer.GetRegion(6, 8, 10, 10); + Buffer2DRegion area0 = buffer.GetRegion(6, 8, 10, 10); - BufferRegion area1 = area0.GetSubArea(4, 4, 5, 5); + Buffer2DRegion area1 = area0.GetSubRegion(4, 4, 5, 5); var expectedRect = new Rectangle(10, 12, 5, 5); @@ -106,7 +106,7 @@ namespace SixLabors.ImageSharp.Tests.Memory this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - BufferRegion area0 = buffer.GetRegion(6, 8, 10, 10); + Buffer2DRegion area0 = buffer.GetRegion(6, 8, 10, 10); ref int r = ref area0.GetReferenceToOrigin(); @@ -140,7 +140,7 @@ namespace SixLabors.ImageSharp.Tests.Memory this.memoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity; using Buffer2D buffer = this.CreateTestBuffer(20, 30); - BufferRegion region = buffer.GetRegion(5, 5, 10, 10); + Buffer2DRegion region = buffer.GetRegion(5, 5, 10, 10); region.Clear(); Assert.NotEqual(0, buffer[4, 4]); diff --git a/tests/ImageSharp.Tests/Quantization/PixelSamplingStrategyTests.cs b/tests/ImageSharp.Tests/Quantization/PixelSamplingStrategyTests.cs index 40eafc787..2b81e721f 100644 --- a/tests/ImageSharp.Tests/Quantization/PixelSamplingStrategyTests.cs +++ b/tests/ImageSharp.Tests/Quantization/PixelSamplingStrategyTests.cs @@ -32,7 +32,7 @@ namespace SixLabors.ImageSharp.Tests.Quantization using Image image = CreateTestImage(100, 100, 100); var strategy = new ExtensivePixelSamplingStrategy(); - foreach (BufferRegion region in strategy.EnumeratePixelRegions(image)) + foreach (Buffer2DRegion region in strategy.EnumeratePixelRegions(image)) { PaintWhite(region); } @@ -51,7 +51,7 @@ namespace SixLabors.ImageSharp.Tests.Quantization var strategy = new DefaultPixelSamplingStrategy(maximumNumberOfPixels, 0.1); long visitedPixels = 0; - foreach (BufferRegion region in strategy.EnumeratePixelRegions(image)) + foreach (Buffer2DRegion region in strategy.EnumeratePixelRegions(image)) { PaintWhite(region); visitedPixels += region.Width * region.Height; @@ -70,7 +70,7 @@ namespace SixLabors.ImageSharp.Tests.Quantization Assert.True(visitRatio <= 1.1, $"{visitedPixels}>{maximumPixels}"); } - private static void PaintWhite(BufferRegion region) + private static void PaintWhite(Buffer2DRegion region) { var white = new L8(255); for (int y = 0; y < region.Height; y++)