Skip to content

Commit 1ac4042

Browse files
Merge pull request #1194 from SixLabors/js-buffer2dregion
BufferRegion => Buffer2DRegion
2 parents 0c6f0dc + bedd0a9 commit 1ac4042

File tree

18 files changed

+59
-59
lines changed

18 files changed

+59
-59
lines changed

src/ImageSharp/Formats/Gif/GifDecoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ private void RestoreToBackground<TPixel>(ImageFrame<TPixel> frame)
543543
return;
544544
}
545545

546-
BufferRegion<TPixel> pixelRegion = frame.PixelBuffer.GetRegion(this.restoreArea.Value);
546+
Buffer2DRegion<TPixel> pixelRegion = frame.PixelBuffer.GetRegion(this.restoreArea.Value);
547547
pixelRegion.Clear();
548548

549549
this.restoreArea = null;

src/ImageSharp/Formats/Jpeg/Components/Block8x8F.ScaledCopyTo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ internal partial struct Block8x8F
1515
/// Copy block data into the destination color buffer pixel area with the provided horizontal and vertical scale factors.
1616
/// </summary>
1717
[MethodImpl(InliningOptions.ShortMethod)]
18-
public void ScaledCopyTo(in BufferRegion<float> region, int horizontalScale, int verticalScale)
18+
public void ScaledCopyTo(in Buffer2DRegion<float> region, int horizontalScale, int verticalScale)
1919
{
2020
ref float areaOrigin = ref region.GetReferenceToOrigin();
2121
this.ScaledCopyTo(ref areaOrigin, region.Stride, horizontalScale, verticalScale);

src/ImageSharp/Memory/Buffer2DExtensions.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,29 +80,29 @@ internal static Rectangle FullRectangle<T>(this Buffer2D<T> buffer)
8080
}
8181

8282
/// <summary>
83-
/// Return a <see cref="BufferRegion{T}"/> to the subarea represented by 'rectangle'
83+
/// Return a <see cref="Buffer2DRegion{T}"/> to the subregion represented by 'rectangle'
8484
/// </summary>
8585
/// <typeparam name="T">The element type</typeparam>
8686
/// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
87-
/// <param name="rectangle">The rectangle subarea</param>
88-
/// <returns>The <see cref="BufferRegion{T}"/></returns>
89-
internal static BufferRegion<T> GetRegion<T>(this Buffer2D<T> buffer, in Rectangle rectangle)
87+
/// <param name="rectangle">The rectangle subregion</param>
88+
/// <returns>The <see cref="Buffer2DRegion{T}"/></returns>
89+
internal static Buffer2DRegion<T> GetRegion<T>(this Buffer2D<T> buffer, Rectangle rectangle)
9090
where T : unmanaged =>
91-
new BufferRegion<T>(buffer, rectangle);
91+
new Buffer2DRegion<T>(buffer, rectangle);
9292

93-
internal static BufferRegion<T> GetRegion<T>(this Buffer2D<T> buffer, int x, int y, int width, int height)
93+
internal static Buffer2DRegion<T> GetRegion<T>(this Buffer2D<T> buffer, int x, int y, int width, int height)
9494
where T : unmanaged =>
95-
new BufferRegion<T>(buffer, new Rectangle(x, y, width, height));
95+
new Buffer2DRegion<T>(buffer, new Rectangle(x, y, width, height));
9696

9797
/// <summary>
98-
/// Return a <see cref="BufferRegion{T}"/> to the whole area of 'buffer'
98+
/// Return a <see cref="Buffer2DRegion{T}"/> to the whole area of 'buffer'
9999
/// </summary>
100100
/// <typeparam name="T">The element type</typeparam>
101101
/// <param name="buffer">The <see cref="Buffer2D{T}"/></param>
102-
/// <returns>The <see cref="BufferRegion{T}"/></returns>
103-
internal static BufferRegion<T> GetRegion<T>(this Buffer2D<T> buffer)
102+
/// <returns>The <see cref="Buffer2DRegion{T}"/></returns>
103+
internal static Buffer2DRegion<T> GetRegion<T>(this Buffer2D<T> buffer)
104104
where T : unmanaged =>
105-
new BufferRegion<T>(buffer);
105+
new Buffer2DRegion<T>(buffer);
106106

107107
/// <summary>
108108
/// Returns the size of the buffer.

src/ImageSharp/Memory/BufferRegion{T}.cs renamed to src/ImageSharp/Memory/Buffer2DRegion{T}.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ namespace SixLabors.ImageSharp.Memory
99
/// Represents a rectangular region inside a 2D memory buffer (<see cref="Buffer2D{T}"/>).
1010
/// </summary>
1111
/// <typeparam name="T">The element type.</typeparam>
12-
public readonly struct BufferRegion<T>
12+
public readonly struct Buffer2DRegion<T>
1313
where T : unmanaged
1414
{
1515
/// <summary>
16-
/// Initializes a new instance of the <see cref="BufferRegion{T}"/> struct.
16+
/// Initializes a new instance of the <see cref="Buffer2DRegion{T}"/> struct.
1717
/// </summary>
1818
/// <param name="buffer">The <see cref="Buffer2D{T}"/>.</param>
1919
/// <param name="rectangle">The <see cref="Rectangle"/> defining a rectangular area within the buffer.</param>
2020
[MethodImpl(MethodImplOptions.AggressiveInlining)]
21-
public BufferRegion(Buffer2D<T> buffer, Rectangle rectangle)
21+
public Buffer2DRegion(Buffer2D<T> buffer, Rectangle rectangle)
2222
{
2323
DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.X, 0, nameof(rectangle));
2424
DebugGuard.MustBeGreaterThanOrEqualTo(rectangle.Y, 0, nameof(rectangle));
@@ -30,11 +30,11 @@ public BufferRegion(Buffer2D<T> buffer, Rectangle rectangle)
3030
}
3131

3232
/// <summary>
33-
/// Initializes a new instance of the <see cref="BufferRegion{T}"/> struct.
33+
/// Initializes a new instance of the <see cref="Buffer2DRegion{T}"/> struct.
3434
/// </summary>
3535
/// <param name="buffer">The <see cref="Buffer2D{T}"/>.</param>
3636
[MethodImpl(MethodImplOptions.AggressiveInlining)]
37-
public BufferRegion(Buffer2D<T> buffer)
37+
public Buffer2DRegion(Buffer2D<T> buffer)
3838
: this(buffer, buffer.FullRectangle())
3939
{
4040
}
@@ -98,35 +98,35 @@ public Span<T> GetRowSpan(int y)
9898
}
9999

100100
/// <summary>
101-
/// Returns a sub-area as <see cref="BufferRegion{T}"/>. (Similar to <see cref="Span{T}.Slice(int, int)"/>.)
101+
/// Returns a subregion as <see cref="Buffer2DRegion{T}"/>. (Similar to <see cref="Span{T}.Slice(int, int)"/>.)
102102
/// </summary>
103-
/// <param name="x">The x index at the subarea origin.</param>
104-
/// <param name="y">The y index at the subarea origin.</param>
105-
/// <param name="width">The desired width of the subarea.</param>
106-
/// <param name="height">The desired height of the subarea.</param>
107-
/// <returns>The subarea</returns>
103+
/// <param name="x">The x index at the subregion origin.</param>
104+
/// <param name="y">The y index at the subregion origin.</param>
105+
/// <param name="width">The desired width of the subregion.</param>
106+
/// <param name="height">The desired height of the subregion.</param>
107+
/// <returns>The subregion</returns>
108108
[MethodImpl(MethodImplOptions.AggressiveInlining)]
109-
public BufferRegion<T> GetSubArea(int x, int y, int width, int height)
109+
public Buffer2DRegion<T> GetSubRegion(int x, int y, int width, int height)
110110
{
111111
var rectangle = new Rectangle(x, y, width, height);
112-
return this.GetSubArea(rectangle);
112+
return this.GetSubRegion(rectangle);
113113
}
114114

115115
/// <summary>
116-
/// Returns a sub-area as <see cref="BufferRegion{T}"/>. (Similar to <see cref="Span{T}.Slice(int, int)"/>.)
116+
/// Returns a subregion as <see cref="Buffer2DRegion{T}"/>. (Similar to <see cref="Span{T}.Slice(int, int)"/>.)
117117
/// </summary>
118-
/// <param name="rectangle">The <see cref="Rectangle"/> specifying the boundaries of the subarea</param>
119-
/// <returns>The subarea</returns>
118+
/// <param name="rectangle">The <see cref="Rectangle"/> specifying the boundaries of the subregion</param>
119+
/// <returns>The subregion</returns>
120120
[MethodImpl(MethodImplOptions.AggressiveInlining)]
121-
public BufferRegion<T> GetSubArea(Rectangle rectangle)
121+
public Buffer2DRegion<T> GetSubRegion(Rectangle rectangle)
122122
{
123123
DebugGuard.MustBeLessThanOrEqualTo(rectangle.Width, this.Rectangle.Width, nameof(rectangle));
124124
DebugGuard.MustBeLessThanOrEqualTo(rectangle.Height, this.Rectangle.Height, nameof(rectangle));
125125

126126
int x = this.Rectangle.X + rectangle.X;
127127
int y = this.Rectangle.Y + rectangle.Y;
128128
rectangle = new Rectangle(x, y, rectangle.Width, rectangle.Height);
129-
return new BufferRegion<T>(this.Buffer, rectangle);
129+
return new Buffer2DRegion<T>(this.Buffer, rectangle);
130130
}
131131

132132
/// <summary>

src/ImageSharp/Processing/Processors/Quantization/DefaultPixelSamplingStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public DefaultPixelSamplingStrategy(int maximumPixels, double minimumScanRatio)
5050
public double MinimumScanRatio { get; }
5151

5252
/// <inheritdoc />
53-
public IEnumerable<BufferRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
53+
public IEnumerable<Buffer2DRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
5454
where TPixel : unmanaged, IPixel<TPixel>
5555
{
5656
long maximumPixels = Math.Min(this.MaximumPixels, (long)image.Width * image.Height * image.Frames.Count);
@@ -95,7 +95,7 @@ public IEnumerable<BufferRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPi
9595
}
9696
}
9797

98-
BufferRegion<TPixel> GetRow(int pos)
98+
Buffer2DRegion<TPixel> GetRow(int pos)
9999
{
100100
int frameIdx = pos / image.Height;
101101
int y = pos % image.Height;

src/ImageSharp/Processing/Processors/Quantization/ExtensivePixelSamplingStrategy.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
1313
public class ExtensivePixelSamplingStrategy : IPixelSamplingStrategy
1414
{
1515
/// <inheritdoc />
16-
public IEnumerable<BufferRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
16+
public IEnumerable<Buffer2DRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
1717
where TPixel : unmanaged, IPixel<TPixel>
1818
{
1919
foreach (ImageFrame<TPixel> frame in image.Frames)

src/ImageSharp/Processing/Processors/Quantization/IPixelSamplingStrategy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ namespace SixLabors.ImageSharp.Processing.Processors.Quantization
1313
public interface IPixelSamplingStrategy
1414
{
1515
/// <summary>
16-
/// Enumerates pixel regions within the image as <see cref="BufferRegion{T}"/>.
16+
/// Enumerates pixel regions within the image as <see cref="Buffer2DRegion{T}"/>.
1717
/// </summary>
1818
/// <param name="image">The image.</param>
1919
/// <typeparam name="TPixel">The pixel type.</typeparam>
2020
/// <returns>An enumeration of pixel regions.</returns>
21-
IEnumerable<BufferRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
21+
IEnumerable<Buffer2DRegion<TPixel>> EnumeratePixelRegions<TPixel>(Image<TPixel> image)
2222
where TPixel : unmanaged, IPixel<TPixel>;
2323
}
2424
}

src/ImageSharp/Processing/Processors/Quantization/IQuantizer{TPixel}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public interface IQuantizer<TPixel> : IDisposable
3535
/// <summary>
3636
/// Adds colors to the quantized palette from the given pixel source.
3737
/// </summary>
38-
/// <param name="pixelRegion">The <see cref="BufferRegion{T}"/> of source pixels to register.</param>
39-
void AddPaletteColors(BufferRegion<TPixel> pixelRegion);
38+
/// <param name="pixelRegion">The <see cref="Buffer2DRegion{T}"/> of source pixels to register.</param>
39+
void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion);
4040

4141
/// <summary>
4242
/// Quantizes an image frame and return the resulting output pixels.

src/ImageSharp/Processing/Processors/Quantization/OctreeQuantizer{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public ReadOnlyMemory<TPixel> Palette
6969

7070
/// <inheritdoc/>
7171
[MethodImpl(InliningOptions.ShortMethod)]
72-
public void AddPaletteColors(BufferRegion<TPixel> pixelRegion)
72+
public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
7373
{
7474
Rectangle bounds = pixelRegion.Rectangle;
7575
Buffer2D<TPixel> source = pixelRegion.Buffer;

src/ImageSharp/Processing/Processors/Quantization/PaletteQuantizer{TPixel}.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public readonly IndexedImageFrame<TPixel> QuantizeFrame(ImageFrame<TPixel> sourc
5454

5555
/// <inheritdoc/>
5656
[MethodImpl(InliningOptions.ShortMethod)]
57-
public void AddPaletteColors(BufferRegion<TPixel> pixelRegion)
57+
public void AddPaletteColors(Buffer2DRegion<TPixel> pixelRegion)
5858
{
5959
}
6060

0 commit comments

Comments
 (0)