Browse Source

Don't use Linq and test for common path first.

js/color-alpha-handling
James Jackson-South 5 years ago
parent
commit
33df55aef2
  1. 10
      src/ImageSharp/Image{TPixel}.cs

10
src/ImageSharp/Image{TPixel}.cs

@ -201,14 +201,14 @@ namespace SixLabors.ImageSharp
public bool TryGetSinglePixelSpan(out Span<TPixel> span)
{
IMemoryGroup<TPixel> mg = this.GetPixelMemoryGroup();
if (mg.Count > 1)
if (mg.Count == 1)
{
span = default;
return false;
span = mg[0].Span;
return true;
}
span = mg.Single().Span;
return true;
span = default;
return false;
}
/// <summary>

Loading…
Cancel
Save