From 6dfb6a8023932e0c488b40c87e94b276e26e0b62 Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Tue, 15 Nov 2016 16:47:03 +1100 Subject: [PATCH] Use optimized write CopyTo for png encoding --- src/ImageSharp/Formats/Png/PngEncoderCore.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ImageSharp/Formats/Png/PngEncoderCore.cs b/src/ImageSharp/Formats/Png/PngEncoderCore.cs index bca1d0033f..ab6d09348c 100644 --- a/src/ImageSharp/Formats/Png/PngEncoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngEncoderCore.cs @@ -317,8 +317,7 @@ namespace ImageSharp.Formats where TPacked : struct { // We can use the optimized PixelAccessor here and copy the bytes in unmanaged memory. - int bpp = this.bytesPerPixel; - using (PixelRow pixelRow = new PixelRow(this.width, rawScanline, bpp == 4 ? ComponentOrder.XYZW : ComponentOrder.XYZ)) + using (PixelRow pixelRow = new PixelRow(this.width, rawScanline, this.bytesPerPixel == 4 ? ComponentOrder.XYZW : ComponentOrder.XYZ)) { pixels.CopyTo(pixelRow, row); }