Browse Source
Merge pull request #591 from brianpopow/feature/fix-576
Fix for #576, using explicit struct layout for bgr24 and rgb24
pull/580/merge
James Jackson-South
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
9 additions and
6 deletions
-
src/ImageSharp/PixelFormats/Bgr24.cs
-
src/ImageSharp/PixelFormats/Rgb24.cs
-
tests/ImageSharp.Tests/Image/ImageCloneTests.cs
|
|
|
@ -14,22 +14,25 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// Ranges from [0, 0, 0, 1] to [1, 1, 1, 1] in vector form.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
[StructLayout(LayoutKind.Sequential)] |
|
|
|
[StructLayout(LayoutKind.Explicit)] |
|
|
|
public struct Bgr24 : IPixel<Bgr24> |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// The blue component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(0)] |
|
|
|
public byte B; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The green component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(1)] |
|
|
|
public byte G; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The red component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(2)] |
|
|
|
public byte R; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
@ -15,22 +15,25 @@ namespace SixLabors.ImageSharp.PixelFormats |
|
|
|
/// Ranges from [0, 0, 0, 1] to [1, 1, 1, 1] in vector form.
|
|
|
|
/// </para>
|
|
|
|
/// </summary>
|
|
|
|
[StructLayout(LayoutKind.Sequential)] |
|
|
|
[StructLayout(LayoutKind.Explicit)] |
|
|
|
public struct Rgb24 : IPixel<Rgb24> |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// The red component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(0)] |
|
|
|
public byte R; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The green component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(1)] |
|
|
|
public byte G; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The blue component.
|
|
|
|
/// </summary>
|
|
|
|
[FieldOffset(2)] |
|
|
|
public byte B; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
@ -33,10 +33,7 @@ namespace SixLabors.ImageSharp.Tests |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// https://github.com/SixLabors/ImageSharp/issues/576
|
|
|
|
/// </summary>
|
|
|
|
[Theory(Skip = "See https://github.com/SixLabors/ImageSharp/issues/576")] |
|
|
|
[Theory] |
|
|
|
[WithTestPatternImages(9, 9, PixelTypes.Rgba32)] |
|
|
|
public void CloneAs_ToBgr24(TestImageProvider<Rgba32> provider) |
|
|
|
{ |
|
|
|
|