diff --git a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs index 692889556..9630c707e 100644 --- a/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs +++ b/src/ImageSharp.Drawing/Brushes/SolidBrush{TPixel}.cs @@ -89,28 +89,20 @@ namespace SixLabors.ImageSharp.Drawing.Brushes /// internal override void Apply(Span scanline, int x, int y) { - try - { - Span destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length); - - MemoryManager memoryManager = this.Target.MemoryManager; + Span destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length); - using (IBuffer amountBuffer = memoryManager.Allocate(scanline.Length)) - { - Span amountSpan = amountBuffer.Span; + MemoryManager memoryManager = this.Target.MemoryManager; - for (int i = 0; i < scanline.Length; i++) - { - amountSpan[i] = scanline[i] * this.Options.BlendPercentage; - } + using (IBuffer amountBuffer = memoryManager.Allocate(scanline.Length)) + { + Span amountSpan = amountBuffer.Span; - this.Blender.Blend(memoryManager, destinationRow, destinationRow, this.Colors.Span, amountSpan); + for (int i = 0; i < scanline.Length; i++) + { + amountSpan[i] = scanline[i] * this.Options.BlendPercentage; } - } - catch (Exception) - { - // TODO: Why are we catching exceptions here silently ??? - throw; + + this.Blender.Blend(memoryManager, destinationRow, destinationRow, this.Colors.Span, amountSpan); } } } diff --git a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs index 953a6fcb2..9f4dba5b4 100644 --- a/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs +++ b/src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs @@ -224,7 +224,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp var color = default(TPixel); var rgba = new Rgba32(0, 0, 0, 255); - using (var buffer = this.configuration.MemoryManager.Allocate2D(width, height, true)) + using (var buffer = this.memoryManager.AllocateClean2D(width, height)) { this.UncompressRle8(width, buffer.Span); @@ -346,7 +346,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp padding = 4 - padding; } - using (IManagedByteBuffer row = this.configuration.MemoryManager.AllocateManagedByteBuffer(arrayWidth + padding, true)) + using (IManagedByteBuffer row = this.memoryManager.AllocateCleanManagedByteBuffer(arrayWidth + padding)) { var color = default(TPixel); var rgba = new Rgba32(0, 0, 0, 255); @@ -398,7 +398,7 @@ namespace SixLabors.ImageSharp.Formats.Bmp var color = default(TPixel); var rgba = new Rgba32(0, 0, 0, 255); - using (var buffer = this.configuration.MemoryManager.AllocateManagedByteBuffer(stride)) + using (var buffer = this.memoryManager.AllocateManagedByteBuffer(stride)) { for (int y = 0; y < height; y++) { diff --git a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs b/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs index 39a6bee2e..ca167015b 100644 --- a/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs +++ b/src/ImageSharp/Formats/Jpeg/Common/Block8x8F.CopyTo.cs @@ -53,7 +53,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common public void CopyTo(BufferArea area) { ref byte selfBase = ref Unsafe.As(ref this); - ref byte destBase = ref Unsafe.As(ref area.GetReferenceToOrigo()); + ref byte destBase = ref Unsafe.As(ref area.GetReferenceToOrigin()); int destStride = area.Stride * sizeof(float); CopyRowImpl(ref selfBase, ref destBase, destStride, 0); @@ -76,7 +76,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common private void CopyTo2x2(BufferArea area) { - ref float destBase = ref area.GetReferenceToOrigo(); + ref float destBase = ref area.GetReferenceToOrigin(); int destStride = area.Stride; this.WidenCopyImpl2x2(ref destBase, 0, destStride); diff --git a/src/ImageSharp/Memory/BufferArea{T}.cs b/src/ImageSharp/Memory/BufferArea{T}.cs index 850cc4c16..e88ed6ca8 100644 --- a/src/ImageSharp/Memory/BufferArea{T}.cs +++ b/src/ImageSharp/Memory/BufferArea{T}.cs @@ -78,7 +78,7 @@ namespace SixLabors.ImageSharp.Memory /// /// The reference to the [0,0] element [MethodImpl(MethodImplOptions.AggressiveInlining)] - public ref T GetReferenceToOrigo() => + public ref T GetReferenceToOrigin() => ref this.DestinationBuffer.Span[(this.Rectangle.Y * this.DestinationBuffer.Width) + this.Rectangle.X]; ///