Faster glyph baking (new font sizes): @native rasterizer/rect packer/pixel loops, glyph shape cache, reused rasterizer scratch (edges, points, active edges, scanlines); fix leaked global 'step'

This commit is contained in:
4DBug committed 2026-10-17 08:57:15 -05:00
1 parent 25a7387642
commit 3a4fc158fa
8 files changed
+452 -39

No files matched your search

+4 -1
View File
@@ -49,6 +49,7 @@ end
--- @param buf char[] # 1-based
--- @param base int # 1-based start index
--- @param u32 ImU32
@native
local function write_u32(buf, base, u32)
buf[base + 0] = bit32.band(u32, 0xFF)
buf[base + 1] = bit32.band(bit32.rshift(u32, 8), 0xFF)
@@ -778,6 +779,7 @@ end
--- @param dst_pitch int
--- @param w int
--- @param h int
@native
function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixels, dst_pixels_base, dst_fmt, dst_pitch, w, h)
IM_ASSERT(src_pixels ~= nil and dst_pixels ~= nil)
local src_pixels_base = 1
@@ -795,7 +797,8 @@ function ImFontAtlasTextureBlockConvert(src_pixels, src_fmt, src_pitch, dst_pixe
local alpha = src_pixels[src_pixels_base + 0]
src_pixels_base = src_pixels_base + 1
write_u32(dst_pixels, dst_pixels_base, IM_COL32(255, 255, 255, alpha))
-- [Luau] inline write_u32(dst_pixels, dst_pixels_base, IM_COL32(255, 255, 255, alpha))
dst_pixels[dst_pixels_base] = 255; dst_pixels[dst_pixels_base + 1] = 255; dst_pixels[dst_pixels_base + 2] = 255; dst_pixels[dst_pixels_base + 3] = alpha
dst_pixels_base = dst_pixels_base + 4
end