Skip to content

Commit

Permalink
fix image compatibility under Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
Asvel committed Feb 23, 2025
1 parent 1ba191a commit a42b6e5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/StaticData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ internal class StaticData
{
public static readonly JsonSerializerOptions JsonOptions = new() { Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping };
public static readonly byte[] BmpHeader = [
0x42, 0x4D, 0x46, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x38, 0x00,
0x42, 0x4D, 0x7A, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7A, 0x00, 0x00, 0x00, 0x6C, 0x00,
0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0xD8, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x20, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x60, 0x09, 0x00, 0x00, 0x60, 0x09, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
// Firefox 不支持只带 alpha mask 不带后续 color space 内容的 DIB header,加个无效的 bV4CSType=-1 哄哄它
// https://hg.mozilla.org/mozilla-central/file/tip/image/decoders/nsBMPDecoder.cpp
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
];

public readonly Dictionary<string, byte[]> Jsons = [];
Expand Down

0 comments on commit a42b6e5

Please sign in to comment.