From 3bc323e26848caaaacb4c0f9d3f6f9ebdea0813d Mon Sep 17 00:00:00 2001 From: 20kdc Date: Mon, 9 Jul 2018 18:17:49 +0100 Subject: [PATCH] Fix bitmap library issues, bugfixes to everest and glacier --- claw/code-claw.lua | 2 +- code/apps/sys-everest.lua | 6 +++--- code/apps/sys-glacier.lua | 2 +- code/libs/bmp.lua | 26 +++++++++++++------------- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/claw/code-claw.lua b/claw/code-claw.lua index 1c14e61..b96e424 100644 --- a/claw/code-claw.lua +++ b/claw/code-claw.lua @@ -3,7 +3,7 @@ return { ["neo"] = { desc = "KittenOS NEO Kernel & Base Libs", - v = 4, + v = 5, deps = { }, dirs = { diff --git a/code/apps/sys-everest.lua b/code/apps/sys-everest.lua index 088e17b..5c100e3 100644 --- a/code/apps/sys-everest.lua +++ b/code/apps/sys-everest.lua @@ -142,10 +142,10 @@ local function doBackgroundLine(m, mg, bdx, bdy, bdl) local str = unicode.sub(statusLine, bdx, bdx + bdl - 1) local strl = unicode.len(str) pcall(mg.set, bdx, bdy, unicode.undoSafeTextFormat(str)) - pcall(mg.fill, bdx + strl, bdy, bdl - strl, 1, " ") + pcall(mg.set, bdx + strl, bdy, (" "):rep(bdl - strl)) else monitorGPUColours(m, mg, 0x000040, 0) - pcall(mg.fill, bdx, bdy, bdl, 1, " ") + pcall(mg.set, bdx, bdy, (" "):rep(bdl)) end end @@ -778,7 +778,7 @@ while not shuttingDown do if os1 then changeFocus(os1) else - changeFocus(surfaces[1]) + changeFocus() end end if s[1] == "x.neo.sys.screens" then diff --git a/code/apps/sys-glacier.lua b/code/apps/sys-glacier.lua index 221481f..b4c25cf 100644 --- a/code/apps/sys-glacier.lua +++ b/code/apps/sys-glacier.lua @@ -125,7 +125,7 @@ local mBase = { end return s end, - delSetting = function () + delSetting = function (name) neo.ensureType(name, "string") local val = nil if name == "password" or name == "pub.clipboard" then val = "" end diff --git a/code/libs/bmp.lua b/code/libs/bmp.lua index 8b93cd8..2ab24f7 100644 --- a/code/libs/bmp.lua +++ b/code/libs/bmp.lua @@ -153,20 +153,8 @@ return { local planes = get16(0x1A) local bpp = get16(0x1C) local compression = get32(0x1E) - local paletteCol = 0 - local other = get32(0x2E) - paletteCol = other - -- postprocess + local paletteCol = get32(0x2E) - -- The actual values used for addressing, for cMode to mess with - local basePtr = 14 + hdrSize + (paletteCol * 4) - local scanWB = math.ceil((bpp * width) / 32) * 4 - local monoWB = (math.ceil((bpp * width) / 32) * 4) - local planeWB = scanWB * height - - if not packed then - basePtr = get32(0x0A) -- 'BM' header - end -- negative height means sane coords local upDown = true if height >= 0x80000000 then @@ -175,6 +163,18 @@ return { upDown = false end + -- postprocess + + -- The actual values used for addressing, for cMode to mess with + local basePtr = 14 + hdrSize + (paletteCol * 4) + local scanWB = math.ceil((bpp * width) / 32) * 4 + local monoWB = math.ceil(width / 32) * 4 + local planeWB = scanWB * height + + if not packed then + basePtr = get32(0x0A) -- 'BM' header + end + -- Cursor/Icon if cMode then height = math.floor(height / 2)