cleanup comments, update translations, bump to 0.4.1
This commit is contained in:
parent
9edcc9841b
commit
7d8ab87eee
28 changed files with 412 additions and 1114 deletions
10
src/icons.js
10
src/icons.js
|
|
@ -120,17 +120,13 @@ function pngSize(img) {
|
|||
return null
|
||||
}
|
||||
|
||||
// Raw RT_ICON payloads are BITMAPINFOHEADER-based bitmaps: biSize, biWidth,
|
||||
// biHeight (2x the visible height - XOR + AND mask), biPlanes, biBitCount,
|
||||
// ..., biClrUsed. Read the real dimensions from there instead of treating the
|
||||
// first bytes as an ICONDIRENTRY (which yielded garbage like h=0, planes=48
|
||||
// and made Chromium decode an empty image).
|
||||
// RT_ICON payloads are BITMAPINFOHEADER bitmaps; read real dimensions from
|
||||
// there (ICONDIRENTRY-style first bytes yield garbage).
|
||||
function bmpDims(img) {
|
||||
if (img.length < 12) return null
|
||||
const biSize = img.readUInt32LE(0)
|
||||
if (biSize === 12) {
|
||||
// BITMAPCOREHEADER (Win 2.x/3.x era icons): DWORD size, then WORD width,
|
||||
// height, planes, bitcount
|
||||
// BITMAPCOREHEADER (old icons): WORD width/height/planes/bitcount
|
||||
const w = img.readUInt16LE(4)
|
||||
const h = Math.floor(img.readUInt16LE(6) / 2)
|
||||
const planes = img.readUInt16LE(8) || 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue