Browse Source

Merge pull request #1407 from SixLabors/js/TryGetSinglePixelSpan

Optimize TryGetSinglePixelSpan
js/color-alpha-handling
James Jackson-South 6 years ago
committed by GitHub
parent
commit
10a98530e4
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  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