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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
5 deletions
-
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>
|
|
|
|
|