From e244ff9013ddd7501e8bca3cc5f1e2249b753e06 Mon Sep 17 00:00:00 2001 From: Peter Amrehn Date: Tue, 14 Jan 2020 23:16:36 +0100 Subject: [PATCH] Lossless WebP: avoid duplicate if by moving the negated condition to the else case --- src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs b/src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs index d4c1e7569..839fe5b68 100644 --- a/src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs +++ b/src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs @@ -131,6 +131,10 @@ namespace SixLabors.ImageSharp.Formats.WebP numberOfTransformsPresent++; } } + else + { + decoder.Metadata = new Vp8LMetadata(); + } // Color cache. bool colorCachePresent = this.bitReader.ReadBit(); @@ -173,10 +177,6 @@ namespace SixLabors.ImageSharp.Formats.WebP IMemoryOwner pixelData = this.memoryAllocator.Allocate(decoder.Width * decoder.Height, AllocationOptions.Clean); this.DecodeImageData(decoder, pixelData.GetSpan(), colorCacheSize, colorCache); - if (!isLevel0) - { - decoder.Metadata = new Vp8LMetadata(); - } return pixelData; }