Browse Source

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

js/color-alpha-handling
James Jackson-South 6 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) public bool TryGetSinglePixelSpan(out Span<TPixel> span)
{ {
IMemoryGroup<TPixel> mg = this.GetPixelMemoryGroup(); IMemoryGroup<TPixel> mg = this.GetPixelMemoryGroup();
if (mg.Count > 1) if (mg.Count == 1)
{ {
span = default; span = mg[0].Span;
return false; return true;
} }
span = mg.Single().Span; span = default;
return true; return false;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save