Browse Source

fix

pull/2579/head
Poker 2 years ago
committed by 舰队的偶像-岛风酱!
parent
commit
5be5d64882
No known key found for this signature in database GPG Key ID: 71F5B3A2B181950C
  1. 4
      src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs
  2. 3
      src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

4
src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

@ -898,7 +898,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals
{ {
int colorIndex = ((rowSpan[offset] >> (8 - bitsPerPixel - (shift * bitsPerPixel))) & mask) * bytesPerColorMapEntry; 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++; offset++;
@ -942,7 +942,7 @@ internal sealed class BmpDecoderCore : IImageDecoderInternals
for (int x = 0; x < width; x++) for (int x = 0; x < width; x++)
{ {
pixelRow[x].FromBgra32(image[newY, x]); pixelRow[x] = TPixel.FromBgra32(image[newY, x]);
} }
} }
} }

3
src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

@ -792,8 +792,7 @@ internal sealed class BmpEncoderCore : IImageEncoderInternals
private static void WriteAlphaMask<TPixel>(in TPixel pixel, ref byte mask, in int index) private static void WriteAlphaMask<TPixel>(in TPixel pixel, ref byte mask, in int index)
where TPixel : unmanaged, IPixel<TPixel> where TPixel : unmanaged, IPixel<TPixel>
{ {
Rgba32 rgba = default; Rgba32 rgba = pixel.ToRgba32();
pixel.ToRgba32(ref rgba);
if (rgba.A is 0) if (rgba.A is 0)
{ {
mask |= unchecked((byte)(0b10000000 >> index)); mask |= unchecked((byte)(0b10000000 >> index));

Loading…
Cancel
Save