From fdd68c7ea49deca87e73ec1424ffb11467a8a96b Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Sun, 8 Oct 2017 13:25:36 +1100 Subject: [PATCH] Remove PixelAccessor and cleanup --- .../Processors/DrawImageProcessor.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs index 213ab1b4a..a88a0a6d0 100644 --- a/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs +++ b/src/ImageSharp.Drawing/Processors/DrawImageProcessor.cs @@ -2,7 +2,6 @@ // Licensed under the Apache License, Version 2.0. using System; -using System.Numerics; using System.Threading.Tasks; using SixLabors.ImageSharp.Advanced; using SixLabors.ImageSharp.Helpers; @@ -42,7 +41,7 @@ namespace SixLabors.ImageSharp.Drawing.Processors /// /// Gets the image to blend. /// - public Image Image { get; private set; } + public Image Image { get; } /// /// Gets the alpha percentage value. @@ -84,9 +83,7 @@ namespace SixLabors.ImageSharp.Drawing.Processors maxY = Math.Min(this.Location.Y + this.Size.Height, maxY); int width = maxX - minX; - using (Buffer amount = new Buffer(width)) - using (PixelAccessor toBlendPixels = targetImage.Lock()) - using (PixelAccessor sourcePixels = source.Lock()) + using (var amount = new Buffer(width)) { for (int i = 0; i < width; i++) { @@ -99,8 +96,8 @@ namespace SixLabors.ImageSharp.Drawing.Processors configuration.ParallelOptions, y => { - Span background = sourcePixels.GetRowSpan(y).Slice(minX, width); - Span foreground = toBlendPixels.GetRowSpan(y - this.Location.Y).Slice(0, width); + Span background = source.GetPixelRowSpan(y).Slice(minX, width); + Span foreground = targetImage.GetPixelRowSpan(y - this.Location.Y).Slice(0, width); this.blender.Blend(background, background, foreground, amount); }); }