ws-cleanup-types: archive, audio, data, font, image, layered, music, playlist, subtitle, vector, video: annotations, casts, one value per re-assignment where the solver loses the type
This commit is contained in:
1 parent
dc98aec2ec
commit
f459b2dcdf
44 files changed
+172
-119
No files matched your search
@@ -209,7 +209,9 @@ function Bmp.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Image?, Err.E
|
||||
if comp == 3 or comp == 6 then
|
||||
hasMasks = true
|
||||
if hs >= 52 then
|
||||
rm, gm, bm = readu32(buf, 54), readu32(buf, 58), readu32(buf, 62)
|
||||
rm = readu32(buf, 54)
|
||||
gm = readu32(buf, 58)
|
||||
bm = readu32(buf, 62)
|
||||
if hs >= 56 then
|
||||
am = readu32(buf, 66)
|
||||
end
|
||||
@@ -218,7 +220,9 @@ function Bmp.decode(r: Bytes.Reader, opts: DecodeOptions?): (Types.Image?, Err.E
|
||||
if palStart + count * 4 > n then
|
||||
return nil, Err.new(Err.TRUNCATED, "truncated bit masks")
|
||||
end
|
||||
rm, gm, bm = readu32(buf, palStart), readu32(buf, palStart + 4), readu32(buf, palStart + 8)
|
||||
rm = readu32(buf, palStart)
|
||||
gm = readu32(buf, palStart + 4)
|
||||
bm = readu32(buf, palStart + 8)
|
||||
if comp == 6 then
|
||||
am = readu32(buf, palStart + 12)
|
||||
end
|
||||
@@ -385,7 +389,8 @@ function Bmp.encode(img: Types.Image, opts: EncodeOptions?): (buffer?, Err.Err?)
|
||||
local dpi = img.meta and img.meta.dpi
|
||||
local xp: number, yp: number = 3780, 3780 -- 96 dpi, as Pillow
|
||||
if type(dpi) == "table" and type(dpi.x) == "number" and type(dpi.y) == "number" and dpi.x > 0 and dpi.y > 0 then
|
||||
xp, yp = math.floor((dpi.x :: number) * 39.3701 + 0.5), math.floor((dpi.y :: number) * 39.3701 + 0.5)
|
||||
xp = math.floor((dpi.x :: number) * 39.3701 + 0.5)
|
||||
yp = math.floor((dpi.y :: number) * 39.3701 + 0.5)
|
||||
end
|
||||
o:i32le(xp)
|
||||
o:i32le(yp)
|
||||
|
||||
Reference in new issue
Block a user