Skip to content

Commit 5be5d64

Browse files
Poker-sangfrg2089
authored andcommitted
fix
1 parent 52f392d commit 5be5d64

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/ImageSharp/Formats/Bmp/BmpDecoderCore.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ private void ReadRgbPaletteWithAlphaMask<TPixel>(BufferedReadStream stream, Buff
898898
{
899899
int colorIndex = ((rowSpan[offset] >> (8 - bitsPerPixel - (shift * bitsPerPixel))) & mask) * bytesPerColorMapEntry;
900900

901-
image[newY, newX].FromBgr24(Unsafe.As<byte, Bgr24>(ref colors[colorIndex]));
901+
image[newY, newX] = Bgra32.FromBgr24(Unsafe.As<byte, Bgr24>(ref colors[colorIndex]));
902902
}
903903

904904
offset++;
@@ -942,7 +942,7 @@ private void ReadRgbPaletteWithAlphaMask<TPixel>(BufferedReadStream stream, Buff
942942

943943
for (int x = 0; x < width; x++)
944944
{
945-
pixelRow[x].FromBgra32(image[newY, x]);
945+
pixelRow[x] = TPixel.FromBgra32(image[newY, x]);
946946
}
947947
}
948948
}

src/ImageSharp/Formats/Bmp/BmpEncoderCore.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,7 @@ private static void ProcessedAlphaMask<TPixel>(Stream stream, Image<TPixel> imag
792792
private static void WriteAlphaMask<TPixel>(in TPixel pixel, ref byte mask, in int index)
793793
where TPixel : unmanaged, IPixel<TPixel>
794794
{
795-
Rgba32 rgba = default;
796-
pixel.ToRgba32(ref rgba);
795+
Rgba32 rgba = pixel.ToRgba32();
797796
if (rgba.A is 0)
798797
{
799798
mask |= unchecked((byte)(0b10000000 >> index));

0 commit comments

Comments
 (0)