Browse Source

Lossless WebP: avoid duplicate if by moving the negated condition to the else case

pull/1552/head
Peter Amrehn 6 years ago
parent
commit
e244ff9013
  1. 8
      src/ImageSharp/Formats/WebP/WebPLosslessDecoder.cs

8
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<uint> pixelData = this.memoryAllocator.Allocate<uint>(decoder.Width * decoder.Height, AllocationOptions.Clean);
this.DecodeImageData(decoder, pixelData.GetSpan(), colorCacheSize, colorCache);
if (!isLevel0)
{
decoder.Metadata = new Vp8LMetadata();
}
return pixelData;
}

Loading…
Cancel
Save