From 74a7e90cf5e75eee5087d10b4f7fa4a1bab32add Mon Sep 17 00:00:00 2001 From: Dmitry Pentin Date: Sun, 11 Jul 2021 10:29:10 +0300 Subject: [PATCH] Refactores post processor buffer clear --- .../Decoder/JpegComponentPostProcessor.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs index 6c25601c2..067eb47be 100644 --- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs +++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegComponentPostProcessor.cs @@ -108,19 +108,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder } } - public void ClearSpectralStride(int step) + // TODO: refactor this + public void ClearSpectralBuffers() { - int yBlockStart = step * this.BlockRowsPerStep; - for (int y = 0; y < this.BlockRowsPerStep; y++) + Buffer2D spectralBlocks = this.Component.SpectralBlocks; + for (int i = 0; i < spectralBlocks.Height; i++) { - int yBlock = yBlockStart + y; - - if (yBlock >= this.SizeInBlocks.Height) - { - break; - } - - this.Component.SpectralBlocks.GetRowSpan(yBlock).Clear(); + spectralBlocks.GetRowSpan(i).Clear(); } }