Skip to content

Commit da49788

Browse files
Revert additional changes
1 parent eec9718 commit da49788

File tree

8 files changed

+18
-18
lines changed

8 files changed

+18
-18
lines changed

src/ImageSharp/Formats/Jpeg/Components/Decoder/ComponentProcessors/ComponentProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public ComponentProcessor(MemoryAllocator memoryAllocator, JpegFrame frame, Size
1616
this.Component = component;
1717

1818
this.BlockAreaSize = component.SubSamplingDivisors * blockSize;
19-
this.ColorBuffer = memoryAllocator.Allocate2DOverAligned<float>(
19+
this.ColorBuffer = memoryAllocator.Allocate2DOveraligned<float>(
2020
postProcessorBufferSize.Width,
2121
postProcessorBufferSize.Height,
2222
this.BlockAreaSize.Height);

src/ImageSharp/Formats/Jpeg/Components/Encoder/ComponentProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public ComponentProcessor(MemoryAllocator memoryAllocator, Component component,
2828
this.blockAreaSize = component.SubSamplingDivisors * 8;
2929

3030
// alignment of 8 so each block stride can be sampled from a single 'ref pointer'
31-
this.ColorBuffer = memoryAllocator.Allocate2DOverAligned<float>(
31+
this.ColorBuffer = memoryAllocator.Allocate2DOveraligned<float>(
3232
postProcessorBufferSize.Width,
3333
postProcessorBufferSize.Height,
3434
8,

src/ImageSharp/Formats/Tga/TgaDecoderCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public Image<TPixel> Decode<TPixel>(BufferedReadStream stream, CancellationToken
8484
throw new UnknownImageFormatException("Width or height cannot be 0");
8585
}
8686

87-
Image<TPixel> image = new(this.configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
87+
Image<TPixel> image = Image.CreateUninitialized<TPixel>(this.configuration, this.fileHeader.Width, this.fileHeader.Height, this.metadata);
8888
Buffer2D<TPixel> pixels = image.GetRootFramePixelBuffer();
8989

9090
if (this.fileHeader.ColorMapType == 1)

src/ImageSharp/Memory/Allocators/MemoryAllocatorOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct MemoryAllocatorOptions
1717
/// </summary>
1818
public int? MaximumPoolSizeMegabytes
1919
{
20-
readonly get => this.maximumPoolSizeMegabytes;
20+
get => this.maximumPoolSizeMegabytes;
2121
set
2222
{
2323
if (value.HasValue)
@@ -35,7 +35,7 @@ public int? MaximumPoolSizeMegabytes
3535
/// </summary>
3636
public int? AllocationLimitMegabytes
3737
{
38-
readonly get => this.allocationLimitMegabytes;
38+
get => this.allocationLimitMegabytes;
3939
set
4040
{
4141
if (value.HasValue)

src/ImageSharp/Memory/MemoryAllocatorExtensions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ public static class MemoryAllocatorExtensions
1818
/// <param name="memoryAllocator">The memory allocator.</param>
1919
/// <param name="width">The buffer width.</param>
2020
/// <param name="height">The buffer height.</param>
21-
/// <param name="preferContiguousImageBuffers">A value indicating whether the allocated buffer should be contiguous, unless bigger than <see cref="int.MaxValue"/>.</param>
21+
/// <param name="preferContiguosImageBuffers">A value indicating whether the allocated buffer should be contiguous, unless bigger than <see cref="int.MaxValue"/>.</param>
2222
/// <param name="options">The allocation options.</param>
2323
/// <returns>The <see cref="Buffer2D{T}"/>.</returns>
2424
public static Buffer2D<T> Allocate2D<T>(
2525
this MemoryAllocator memoryAllocator,
2626
int width,
2727
int height,
28-
bool preferContiguousImageBuffers,
28+
bool preferContiguosImageBuffers,
2929
AllocationOptions options = AllocationOptions.None)
3030
where T : struct
3131
{
3232
long groupLength = (long)width * height;
3333
MemoryGroup<T> memoryGroup;
34-
if (preferContiguousImageBuffers && groupLength < int.MaxValue)
34+
if (preferContiguosImageBuffers && groupLength < int.MaxValue)
3535
{
3636
IMemoryOwner<T> buffer = memoryAllocator.Allocate<T>((int)groupLength, options);
3737
memoryGroup = MemoryGroup<T>.CreateContiguous(buffer, false);
@@ -69,16 +69,16 @@ public static Buffer2D<T> Allocate2D<T>(
6969
/// <typeparam name="T">The type of buffer items to allocate.</typeparam>
7070
/// <param name="memoryAllocator">The memory allocator.</param>
7171
/// <param name="size">The buffer size.</param>
72-
/// <param name="preferContiguousImageBuffers">A value indicating whether the allocated buffer should be contiguous, unless bigger than <see cref="int.MaxValue"/>.</param>
72+
/// <param name="preferContiguosImageBuffers">A value indicating whether the allocated buffer should be contiguous, unless bigger than <see cref="int.MaxValue"/>.</param>
7373
/// <param name="options">The allocation options.</param>
7474
/// <returns>The <see cref="Buffer2D{T}"/>.</returns>
7575
public static Buffer2D<T> Allocate2D<T>(
7676
this MemoryAllocator memoryAllocator,
7777
Size size,
78-
bool preferContiguousImageBuffers,
78+
bool preferContiguosImageBuffers,
7979
AllocationOptions options = AllocationOptions.None)
8080
where T : struct =>
81-
Allocate2D<T>(memoryAllocator, size.Width, size.Height, preferContiguousImageBuffers, options);
81+
Allocate2D<T>(memoryAllocator, size.Width, size.Height, preferContiguosImageBuffers, options);
8282

8383
/// <summary>
8484
/// Allocates a buffer of value type objects interpreted as a 2D region
@@ -96,7 +96,7 @@ public static Buffer2D<T> Allocate2D<T>(
9696
where T : struct =>
9797
Allocate2D<T>(memoryAllocator, size.Width, size.Height, false, options);
9898

99-
internal static Buffer2D<T> Allocate2DOverAligned<T>(
99+
internal static Buffer2D<T> Allocate2DOveraligned<T>(
100100
this MemoryAllocator memoryAllocator,
101101
int width,
102102
int height,

src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeKernelMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ private ResizeKernelMap(
5050
this.sourceLength = sourceLength;
5151
this.DestinationLength = destinationLength;
5252
this.MaxDiameter = (radius * 2) + 1;
53-
this.data = memoryAllocator.Allocate2D<float>(this.MaxDiameter, bufferHeight, preferContiguousImageBuffers: true, AllocationOptions.Clean);
53+
this.data = memoryAllocator.Allocate2D<float>(this.MaxDiameter, bufferHeight, preferContiguosImageBuffers: true, AllocationOptions.Clean);
5454
this.pinHandle = this.data.DangerousGetSingleMemory().Pin();
5555
this.kernels = new ResizeKernel[destinationLength];
5656
this.tempValues = new double[this.MaxDiameter];

src/ImageSharp/Processing/Processors/Transforms/Resize/ResizeWorker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public ResizeWorker(
8383
this.transposedFirstPassBuffer = configuration.MemoryAllocator.Allocate2D<Vector4>(
8484
this.workerHeight,
8585
targetWorkingRect.Width,
86-
preferContiguousImageBuffers: true,
86+
preferContiguosImageBuffers: true,
8787
options: AllocationOptions.Clean);
8888

8989
this.tempRowBuffer = configuration.MemoryAllocator.Allocate<Vector4>(this.sourceRectangle.Width);

tests/ImageSharp.Tests/Memory/Buffer2DTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ public void Construct_PreferContiguousImageBuffers_AllocatesContiguousRegardless
7373
using Buffer2D<byte> buffer = useSizeOverload ?
7474
this.MemoryAllocator.Allocate2D<byte>(
7575
new Size(200, 200),
76-
preferContiguousImageBuffers: true) :
76+
preferContiguosImageBuffers: true) :
7777
this.MemoryAllocator.Allocate2D<byte>(
7878
200,
7979
200,
80-
preferContiguousImageBuffers: true);
80+
preferContiguosImageBuffers: true);
8181
Assert.Equal(1, buffer.FastMemoryGroup.Count);
8282
Assert.Equal(200 * 200, buffer.FastMemoryGroup.TotalLength);
8383
}
@@ -88,7 +88,7 @@ public void Allocate2DOveraligned(int bufferCapacity, int width, int height, int
8888
{
8989
this.MemoryAllocator.BufferCapacityInBytes = sizeof(int) * bufferCapacity;
9090

91-
using Buffer2D<int> buffer = this.MemoryAllocator.Allocate2DOverAligned<int>(width, height, alignmentMultiplier);
91+
using Buffer2D<int> buffer = this.MemoryAllocator.Allocate2DOveraligned<int>(width, height, alignmentMultiplier);
9292
MemoryGroup<int> memoryGroup = buffer.FastMemoryGroup;
9393
int expectedAlignment = width * alignmentMultiplier;
9494

@@ -359,5 +359,5 @@ public void Allocate_IncorrectAmount_ThrowsCorrect_InvalidMemoryOperationExcepti
359359
[Theory]
360360
[MemberData(nameof(InvalidLengths))]
361361
public void Allocate_IncorrectAmount_ThrowsCorrect_InvalidMemoryOperationException_OverAligned(Size size)
362-
=> Assert.Throws<InvalidMemoryOperationException>(() => this.MemoryAllocator.Allocate2DOverAligned<Rgba32>(size.Width, size.Height, 1));
362+
=> Assert.Throws<InvalidMemoryOperationException>(() => this.MemoryAllocator.Allocate2DOveraligned<Rgba32>(size.Width, size.Height, 1));
363363
}

0 commit comments

Comments
 (0)