Browse Source

Avoid LINQ in ReadTransformation

pull/1552/head
Brian Popow 6 years ago
parent
commit
f4ee04dda5
  1. 8
      src/ImageSharp/Formats/WebP/Lossless/WebPLosslessDecoder.cs

8
src/ImageSharp/Formats/WebP/Lossless/WebPLosslessDecoder.cs

@ -629,10 +629,12 @@ namespace SixLabors.ImageSharp.Formats.Experimental.WebP.Lossless
var transform = new Vp8LTransform(transformType, xSize, ySize);
// Each transform is allowed to be used only once.
// TODO: No Linq, avoid 'transform' closure allocation.
if (decoder.Transforms.Any(t => t.TransformType == transform.TransformType))
foreach (Vp8LTransform decoderTransform in decoder.Transforms)
{
WebPThrowHelper.ThrowImageFormatException("Each transform can only be present once");
if (decoderTransform.TransformType == transform.TransformType)
{
WebPThrowHelper.ThrowImageFormatException("Each transform can only be present once");
}
}
switch (transformType)

Loading…
Cancel
Save