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) 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