Poker
2 years ago
committed by
舰队的偶像-岛风酱!
No known key found for this signature in database
GPG Key ID: 71F5B3A2B181950C
2 changed files with
3 additions and
4 deletions
-
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
-
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs
|
|
|
@ -898,7 +898,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals |
|
|
|
{ |
|
|
|
int colorIndex = ((rowSpan[offset] >> (8 - bitsPerPixel - (shift * bitsPerPixel))) & mask) * bytesPerColorMapEntry; |
|
|
|
|
|
|
|
image[newY, newX].FromBgr24(Unsafe.As<byte, Bgr24>(ref colors[colorIndex])); |
|
|
|
image[newY, newX] = Bgra32.FromBgr24(Unsafe.As<byte, Bgr24>(ref colors[colorIndex])); |
|
|
|
} |
|
|
|
|
|
|
|
offset++; |
|
|
|
@ -942,7 +942,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals |
|
|
|
|
|
|
|
for (int x = 0; x < width; x++) |
|
|
|
{ |
|
|
|
pixelRow[x].FromBgra32(image[newY, x]); |
|
|
|
pixelRow[x] = TPixel.FromBgra32(image[newY, x]); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -792,8 +792,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals |
|
|
|
private static void WriteAlphaMask<TPixel>(in TPixel pixel, ref byte mask, in int index) |
|
|
|
where TPixel : unmanaged, IPixel<TPixel> |
|
|
|
{ |
|
|
|
Rgba32 rgba = default; |
|
|
|
pixel.ToRgba32(ref rgba); |
|
|
|
Rgba32 rgba = pixel.ToRgba32(); |
|
|
|
if (rgba.A is 0) |
|
|
|
{ |
|
|
|
mask |= unchecked((byte)(0b10000000 >> index)); |
|
|
|
|