diff --git a/src/ImageSharp/Image.WrapMemory.cs b/src/ImageSharp/Image.WrapMemory.cs index 5fe4c8049..d8cea246f 100644 --- a/src/ImageSharp/Image.WrapMemory.cs +++ b/src/ImageSharp/Image.WrapMemory.cs @@ -403,7 +403,7 @@ public abstract partial class Image /// The pixel type /// The /// The pointer to the target memory buffer to wrap. - /// The byte length of the memory allocated. + /// The byte length of the memory allocated. /// The width of the memory image. /// The height of the memory image. /// The . @@ -413,7 +413,7 @@ public abstract partial class Image public static unsafe Image WrapMemory( Configuration configuration, void* pointer, - int byteLength, + int bufferSizeInBytes, int width, int height, ImageMetadata metadata) @@ -425,7 +425,7 @@ public abstract partial class Image UnmanagedMemoryManager memoryManager = new(pointer, width * height); - Guard.MustBeGreaterThan(byteLength, memoryManager.Memory.Span.Length, nameof(byteLength)); + Guard.MustBeGreaterThanOrEqualTo(bufferSizeInBytes, memoryManager.Memory.Span.Length, nameof(bufferSizeInBytes)); MemoryGroup memorySource = MemoryGroup.Wrap(memoryManager.Memory); return new Image(configuration, memorySource, width, height, metadata); @@ -457,7 +457,7 @@ public abstract partial class Image /// The pixel type /// The /// The pointer to the target memory buffer to wrap. - /// The byte length of the memory allocated. + /// The byte length of the memory allocated. /// The width of the memory image. /// The height of the memory image. /// The configuration is null. @@ -465,11 +465,11 @@ public abstract partial class Image public static unsafe Image WrapMemory( Configuration configuration, void* pointer, - int byteLength, + int bufferSizeInBytes, int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(configuration, pointer, byteLength, width, height, new ImageMetadata()); + => WrapMemory(configuration, pointer, bufferSizeInBytes, width, height, new ImageMetadata()); /// /// @@ -496,15 +496,15 @@ public abstract partial class Image /// /// The pixel type. /// The pointer to the target memory buffer to wrap. - /// The byte length of the memory allocated. + /// The byte length of the memory allocated. /// The width of the memory image. /// The height of the memory image. /// An instance. public static unsafe Image WrapMemory( void* pointer, - int byteLength, + int bufferSizeInBytes, int width, int height) where TPixel : unmanaged, IPixel - => WrapMemory(Configuration.Default, pointer, byteLength, width, height); + => WrapMemory(Configuration.Default, pointer, bufferSizeInBytes, width, height); }