Draw list 1.93: baked round corners in the font atlas (ImFontAtlasBuildUpdateTexDataCorners, fill radii 1..16 + 3 stroke thicknesses) used by AddRect/AddRectFilled when pixel-aligned (_AddRectBaked/_AddRectFilledBaked)

This commit is contained in:
4DBug
2026-10-15 06:55:57 -05:00
parent af2026113a
commit 9872d43fd6
7 changed files with 1357 additions and 232 deletions
+1 -1
View File
@@ -1 +1 @@
[[46, "imgui.lua"], [21461, "imgui_demo.lua"], [33313, "imgui_draw.lua"], [40456, "imgui_h.lua"], [43362, "imgui_impl_roblox.lua"], [45010, "imgui_impl_roblox_fonts.lua"], [51413, "imgui_internal.lua"], [55122, "imgui_tables.lua"], [60181, "imgui_widgets.lua"], [72170, "imstb_rectpack.lua"], [72834, "imstb_textedit.lua"], [74376, "imstb_truetype.lua"], [77164, "imstd_minstdio.lua"]]
[[46, "imgui.lua"], [21461, "imgui_demo.lua"], [33313, "imgui_draw.lua"], [40829, "imgui_h.lua"], [43735, "imgui_impl_roblox.lua"], [45383, "imgui_impl_roblox_fonts.lua"], [51786, "imgui_internal.lua"], [55495, "imgui_tables.lua"], [60554, "imgui_widgets.lua"], [72543, "imstb_rectpack.lua"], [73207, "imstb_textedit.lua"], [74749, "imstb_truetype.lua"], [77537, "imstd_minstdio.lua"]]
+384 -8
View File
@@ -1,7 +1,7 @@
--!optimize 2
-- GENERATED by tools/bundle.py from *.lua, backends/, fonts/ - do not edit
local ImGui, ImVec2, ImVec4, ImRect, HelpMarker, ImVec2_Copy, IMGUI_DEMO_MARKER, ImGuiTableFlags, ImStd, ImVector, ImDrawFlags, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImGuiKey, ImVec2_CopyV, ImGuiStyleVarInfo, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, IM_ASSERT_USER_ERROR_RET, ImHashStr, ImS32, ImGuiColorEditFlags, ImIsPowerOfTwo, ImAbs, ImVec4_Copy, ExampleAppConsoleMT, IM_ROUND, ImGuiTableColumnFlags, ImGuiTreeNodeFlags, PopStyleCompact, PushStyleCompact, ImU16, ExampleNames, ImGuiWindowFlags, ImGuiItemFlags, ImGui_ImplRoblox_GetBackendData, stbte, ImColor, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ExampleTreeFuncs, IM_ASSERT_PARANOID, ImCos, ImGuiListClipper, ImS16, _PathArcToFastExXY, ImGuiMultiSelectFlags, ImGuiTabBarFlags, ImSin, ImUpperPowerOfTwo, IM_F32_TO_INT8_SAT, ImFontAtlasPackGetRect, DockSettingsRenameNodeReferences, ExampleDualListBoxMT, IM_DRAWLIST_TEX_LINES_WIDTH_MAX, ImCeil, ImGuiCol, ImGuiSelectionBasicStorage, ImLengthSqr, ImS8, ImU8, ExampleAppPropertyEditorMT, ImFabs, ImGuiChildFlags, ImGuiLastItemData_Copy, ImGuiScrollFlags, ImLog, ImMemchr, ImStrByte, ExampleSelectionWithDeletionMT, IMGUI_DEBUG_LOG_VIEWPORT, ImGuiInputEvent, ImGuiTextBuffer, ImPow, ImTrunc64, CustomConstraints, ExampleAppLogMT, IMGUI_DEBUG_LOG_FONT, IMGUI_DEBUG_LOG_SELECTION, ImAddClampOverflow, ImFontAtlasBuildInit, ImFontCalcWordWrapPositionEx, ImGuiComboFlags, ImGuiLastItemData, ImGuiPayload_IsDataType, ImGuiPopupFlags, ImGuiSliderFlags, ImGuiTextFilter, ImRotate, ImSqrt, ImSubClampOverflow, ImTextClassifierSetCharClass, MyDocument, ShowExampleMenuFile, CalcNextScrollFromScrollTargetAndClamp, IMGUI_PAYLOAD_TYPE_WINDOW, IMGUI_VERSION, ImCharIsBlankW, ImCharIsSeparatorW, ImFmod, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ImGuiNavMoveFlags, ImGuiStyle_Copy, ImHashData, ImVec1_Copy, ExampleAsset_s_current_sort_specs, ExampleMemberInfo, ExampleTree_CreateNode, IMGUI_PAYLOAD_TYPE_COLOR_4F, IM_F32_TO_INT8_UNBOUND, IM_PI, ImCharIsBlankA, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontDiscardBakes, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImFontAtlasRectId_GetIndex, ImFontAtlasTextureAdd, ImFontAtlasTextureBlockQueueUpload, ImFontAtlasTextureGrow, ImFontBaked_BuildGrowIndex, ImFontConfig, ImFontGlyph, ImGuiTableColumn, ImGuiWindowClass, ImGui_ImplRoblox_RenderDrawData, ImParseFormatFindStart, ImRect_CopyFromV4, ImTextureRect, ImTextureRef, MyItem_s_current_sort_specs, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, DockSettingsHandler_ClearAll, EditTableSizingFlags, ExampleSelectionWithDeletion, IMGUI_DEBUG_LOG_TABLE, IMGUI_PAYLOAD_TYPE_COLOR_3F, IM_FREE, ImDrawListSplitter, ImFontAtlasBakedDiscard, ImFontAtlasBuildDestroy, ImFontAtlasBuildNotifySetFont, ImFontAtlasBuildSetTexture, ImFontAtlasBuildSetupFontBakedFallback, ImFontAtlasFontDestroySourceData, ImFontAtlasPackInit, ImFontAtlasTextureBlockCopy, ImFontAtlasTextureGetSizeEstimate, ImFontAtlasUpdateDrawListsSharedData
local ImGui, ImVec2, ImVec4, ImRect, HelpMarker, ImVec2_Copy, IMGUI_DEMO_MARKER, ImGuiTableFlags, ImStd, ImVector, ImDrawFlags, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImGuiKey, ImVec2_CopyV, ImGuiStyleVarInfo, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, IM_ASSERT_USER_ERROR_RET, ImHashStr, ImS32, ImGuiColorEditFlags, ImIsPowerOfTwo, ImAbs, ImVec4_Copy, ExampleAppConsoleMT, IM_ROUND, ImGuiTableColumnFlags, ImGuiTreeNodeFlags, PopStyleCompact, PushStyleCompact, IM_ASSERT_PARANOID, ImU16, ExampleNames, ImGuiWindowFlags, ImGuiItemFlags, ImGui_ImplRoblox_GetBackendData, stbte, ImColor, ImCos, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ExampleTreeFuncs, ImGuiListClipper, ImS16, _PathArcToFastExXY, ImGuiMultiSelectFlags, ImSin, ImGuiTabBarFlags, ImUpperPowerOfTwo, IM_F32_TO_INT8_SAT, ImFontAtlasPackGetRect, DockSettingsRenameNodeReferences, ExampleDualListBoxMT, IM_DRAWLIST_TEX_LINES_WIDTH_MAX, ImCeil, ImGuiCol, ImGuiSelectionBasicStorage, ImLengthSqr, ImS8, ImU8, ExampleAppPropertyEditorMT, ImFabs, ImGuiChildFlags, ImGuiLastItemData_Copy, ImGuiScrollFlags, ImLog, ImMemchr, ImStrByte, ExampleSelectionWithDeletionMT, IMGUI_DEBUG_LOG_VIEWPORT, ImGuiInputEvent, ImGuiTextBuffer, ImPow, ImTrunc64, CustomConstraints, ExampleAppLogMT, IMGUI_DEBUG_LOG_FONT, IMGUI_DEBUG_LOG_SELECTION, ImAddClampOverflow, ImFontAtlasBuildInit, ImFontCalcWordWrapPositionEx, ImGuiComboFlags, ImGuiLastItemData, ImGuiPayload_IsDataType, ImGuiPopupFlags, ImGuiSliderFlags, ImGuiTextFilter, ImRotate, ImSqrt, ImSubClampOverflow, ImTextClassifierSetCharClass, MyDocument, ShowExampleMenuFile, CalcCornerArcStepAndCount, CalcNextScrollFromScrollTargetAndClamp, IMGUI_PAYLOAD_TYPE_WINDOW, IMGUI_VERSION, ImCharIsBlankW, ImCharIsSeparatorW, ImFmod, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ImGuiNavMoveFlags, ImGuiStyle_Copy, ImHashData, ImVec1_Copy, ExampleAsset_s_current_sort_specs, ExampleMemberInfo, ExampleTree_CreateNode, IMGUI_PAYLOAD_TYPE_COLOR_4F, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC, IM_F32_TO_INT8_UNBOUND, IM_PI, ImCharIsBlankA, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontDiscardBakes, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImFontAtlasRectId_GetIndex, ImFontAtlasTextureAdd, ImFontAtlasTextureBlockQueueUpload, ImFontAtlasTextureGrow, ImFontBaked_BuildGrowIndex, ImFontConfig, ImFontGlyph, ImGuiTableColumn, ImGuiWindowClass, ImGui_ImplRoblox_RenderDrawData, ImParseFormatFindStart, ImRect_CopyFromV4, ImTextureRect, ImTextureRef, MyItem_s_current_sort_specs, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, DockSettingsHandler_ClearAll, EditTableSizingFlags, ExampleSelectionWithDeletion, IMGUI_DEBUG_LOG_TABLE, IMGUI_PAYLOAD_TYPE_COLOR_3F, IM_FREE, ImDrawListSplitter, ImFontAtlasBakedDiscard, ImFontAtlasBuildDestroy, ImFontAtlasBuildNotifySetFont, ImFontAtlasBuildSetTexture, ImFontAtlasBuildSetupFontBakedFallback, ImFontAtlasFontDestroySourceData, ImFontAtlasPackInit, ImFontAtlasRect
local type, mathMin, mathMax, mathFloor, mathCeil, bitOr, bitLShift = type, math.min, math.max, math.floor, math.ceil, bit32.bor, bit32.lshift
local function IM_COL32(R, G, B, A) return (bitOr(bitLShift(A, 24 --[[IM_COL32_A_SHIFT]]), bitLShift(B, 16 --[[IM_COL32_B_SHIFT]]), bitLShift(G, 8 --[[IM_COL32_G_SHIFT]]), bitLShift(R, 0 --[[IM_COL32_R_SHIFT]]))) end
@native
@@ -33758,7 +33758,10 @@ local ImFontAtlasBakedGetClosestMatch
local ImFontAtlasBuildInit
local ImFontAtlasBuildSetTexture
local ImFontAtlasBuildUpdateTexDataLines
local ImFontAtlasBuildUpdateTexDataCorners
local ImFontAtlasBuildUpdateTexDataBasic
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC -- [Luau] forward declared, defined in [SECTION] ImDrawList
local CalcCornerArcStepAndCount -- [Luau] forward declared, defined in [SECTION] ImDrawList
local ImFontAtlasBuildSetupFontLoader
local ImFontAtlasBuildSetupFontSpecialGlyphs
local ImFontAtlasBuildSetupFontBakedBlanks
@@ -35264,7 +35267,7 @@ end
function ImFontAtlasBuildUpdateTexData(atlas)
ImFontAtlasBuildUpdateTexDataBasic(atlas)
ImFontAtlasBuildUpdateTexDataLines(atlas)
-- [Port] TODO baked round corners: ImFontAtlasBuildUpdateTexDataCorners(atlas)
ImFontAtlasBuildUpdateTexDataCorners(atlas)
end
-- Create a new texture, discard previous one
@@ -35388,6 +35391,176 @@ function ImFontAtlasPackInit(atlas)
end
--- @param atlas ImFontAtlas
-- #define IM_DRAWLIST_CORNER_POINTS_MAX (IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4 + 3) // Max number of points in corner profiles
-- [Luau] ImVec2 line_normals[] / float line_distances[] / ImVec2 points[] are flat 1-based scratch arrays (x, y, distance).
local corner_points_x, corner_points_y = {}, {}
local corner_normals_x, corner_normals_y, corner_distances = {}, {}, {}
-- [Luau] line_normals is passed as two arrays (line_normals_x, line_normals_y), 1-based.
local function InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- This tries to quite faithfully replicate how we render the corners using tessellation.
-- Older code sampled a circle SDF directly, but it had clearly visible discrepancy between the baked corners
-- and tessellated corners due to circle_segment_max_error.
local auto_seg_count = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(rounding, circle_segment_max_error)
local arc_step, arc_step_count = CalcCornerArcStepAndCount(auto_seg_count)
local arc_point_count = arc_step_count + 1
-- Build arc of points, with straight segments at each end.
-- . [n-2]..[n-1]
-- .`
-- .
-- [1] x (cx,cy)
-- :
-- [0]
local points_x, points_y = corner_points_x, corner_points_y
local num_points = 0
num_points = num_points + 1; points_x[num_points] = cx - rounding; points_y[num_points] = cy + 1.0
local da = (arc_step / 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]]) * 3.141592653589793 --[[IM_PI]] * 2.0
local a = 3.141592653589793 --[[IM_PI]]
for _ = 0, arc_point_count - 1 do
local dx = ImCos(a)
local dy = ImSin(a)
num_points = num_points + 1; points_x[num_points] = cx + dx * rounding; points_y[num_points] = cy + dy * rounding
a = a + da
end
num_points = num_points + 1; points_x[num_points] = cx + 1.0; points_y[num_points] = cy - rounding
-- Turn segments to half spaces.
for i = 1, num_points - 1 do
local diff_x = points_x[i + 1] - points_x[i]
local diff_y = points_y[i + 1] - points_y[i]
local d2 = diff_x * diff_x + diff_y * diff_y
local inv_d = ImRsqrtPrecise(d2)
line_normals_x[i] = diff_y * inv_d -- Normal points outwards
line_normals_y[i] = -diff_x * inv_d
line_distances[i] = -(points_x[i] * line_normals_x[i] + points_y[i] * line_normals_y[i]) -- -ImDot()
end
return num_points - 1
end
-- Returns distance to convex shape limited by lines.
local function SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local result = -3.4028234663853e+38 --[[FLT_MAX]]
for i = 1, num_lines do
local d = line_normals_x[i] * x + line_normals_y[i] * y + line_distances[i]
if d > result then
result = d
end
end
return result
end
local function SampleCornerFillOrStroke(x, y, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
local d = SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local aa_width = 1.0
if thickness == 0.0 then
-- Fill
return math.floor(ImClamp(1.0 - (d + aa_width * 0.5) / aa_width, 0.0, 1.0) * 255.0) -- (ImU8)
else
-- Stroke
local outer = 1.0 - (d + aa_width * 0.5) / aa_width
local inner = (d + thickness + aa_width * 0.5) / aa_width
return math.floor(ImClamp(ImMin(inner, outer), 0.0, 1.0) * 255.0) -- (ImU8)
end
end
-- [Port] #if 0 DEBUG_TEX_CORNER_U8/DEBUG_TEX_CORNER_U32 coverage visualization not ported (always 0xFF/0xFFFFFFFF).
function ImFontAtlasBuildUpdateTexDataCorners(atlas)
if bit32.band(atlas.Flags, 8 --[[ImFontAtlasFlags.NoBakedRoundCorners]]) ~= 0 then
return
end
-- Pack and store identifier so we can refresh UV coordinates on texture resize.
local tex = atlas.TexData
local builder = atlas.Builder
-- FIXME-TEXCORNERS: Ideally we should pick up the max error from the styles, but it does not seem be to set by the time we build the data the first time.
local circle_segment_max_error = 0.30 -- Default matching ImGuiStyle::CircleTessellationMaxError.
-- if (atlas->OwnerContext)
-- circle_segment_max_error = atlas->OwnerContext->DrawListSharedData.CircleSegmentMaxError;
-- Calculate size and pack
local r = ImFontAtlasRect()
local add_and_draw = (atlas:GetCustomRect(builder.PackIdCornersTexData, r) == false)
if add_and_draw then
-- (thickness 0 for filled, thickness >0 for strokes)
local pack_size_x, pack_size_y = 0, 0 -- ImVec2i
for thickness = 0, 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] - 1 do
local is_filled = (thickness == 0)
local row_width = 0
local row_height = 0
for n = 0, 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] - 1 do
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
row_width = row_width + size + 2
row_height = ImMax(row_height, size + 2)
end
pack_size_x = ImMax(pack_size_x, row_width)
pack_size_y = pack_size_y + row_height
end
builder.PackIdCornersTexData = atlas:AddCustomRect(pack_size_x, pack_size_y, r)
assert(builder.PackIdCornersTexData ~= (-1) --[[ImFontAtlasRectId_Invalid]])
end
-- Render
local y = r.y
local line_normals_x, line_normals_y, line_distances = corner_normals_x, corner_normals_y, corner_distances
for thickness = 0, 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] - 1 do
local is_filled = (thickness == 0)
local x = r.x
local row_height = 0
for n = 0, 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] - 1 do
-- Filled: Always add 1px to the fill side of the rounded corner to prevent the corner AA to bleed into the rectangle edges.
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
local w = size + 2
local h = size + 2
-- Corner circle
local cx = 1.0 + (n + 1)
local cy = 1.0 + (n + 1)
assert((x + w) <= (r.x + r.w) and (y + h) <= (r.y + r.h)) -- Make sure we're inside the texture bounds
local num_lines = InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- Write each slice
if add_and_draw and tex.Format == 1 --[[ImTextureFormat.Alpha8]] then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_ptr[write_ptr_base + lx] = SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
end
write_ptr_base = write_ptr_base + pitch
end
elseif add_and_draw and tex.Format == 0 --[[ImTextureFormat.RGBA32]] then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width * 4
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_u32(write_ptr, write_ptr_base + lx * 4, IM_COL32(255, 255, 255, SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)))
end
write_ptr_base = write_ptr_base + pitch
end
end
-- Refresh UV coordinates
local uv0_x, uv0_y = (x + 1) * atlas.TexUvScale.x, (y + 1) * atlas.TexUvScale.y
local uv1_x, uv1_y = (x + 1 + size) * atlas.TexUvScale.x, (y + 1 + size) * atlas.TexUvScale.y
builder.TexUvCorners[n + thickness * 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]]] = ImVec4(uv0_x, uv0_y, uv1_x, uv1_y)
x = x + w
row_height = ImMax(row_height, h)
end
y = y + row_height
end
end
function ImFontAtlasBuildUpdateTexDataLines(atlas)
if bit32.band(atlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) ~= 0 then
return
@@ -35595,6 +35768,7 @@ function ImFontAtlasUpdateDrawListsSharedData(atlas)
if (shared_data.FontAtlas == atlas) then
shared_data.TexUvWhitePixel = atlas.TexUvWhitePixel
shared_data.TexUvLines = atlas.Builder.TexUvLines
shared_data.TexUvCorners = atlas.Builder.TexUvCorners
end
end
end
@@ -37026,13 +37200,13 @@ end
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN = 4
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX = 512
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]])))) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]]))) / _RAD) end
-- Calculates arc step and step count for 90 degree arc. The calculated arc step will complete a 90 degree arc when stepped arc_step_count times.
-- [Luau] returns arc_step, arc_step_count (C++ out-references)
local function CalcCornerArcStepAndCount(segment_count)
function CalcCornerArcStepAndCount(segment_count)
local quarter = 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] / 4
local arc_step = ImClamp(math.floor(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / segment_count), 1, quarter)
local arc_step_count = math.floor(quarter / arc_step)
@@ -38641,7 +38815,122 @@ function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectBaked() (UseTexForRoundCorners) not ported yet, AddRect() falls back to the geometry path.
-- [Luau] IM_APPEND_VTX() x4 + IM_APPEND_TRI(idx + 0, idx + 1, idx + 2) + IM_APPEND_TRI(idx + 0, idx + 2, idx + 3)
local function AppendQuadUV(self, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, col)
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, x0, y0, u0, v0, col)
WV(vb, vw + 1, x1, y1, u1, v1, col)
WV(vb, vw + 2, x2, y2, u2, v2, col)
WV(vb, vw + 3, x3, y3, u3, v3, col)
ib[iw + 0] = idx + 0; ib[iw + 1] = idx + 1; ib[iw + 2] = idx + 2
ib[iw + 3] = idx + 0; ib[iw + 4] = idx + 2; ib[iw + 5] = idx + 3
self._VtxWritePtr = vw + 4
self._IdxWritePtr = iw + 6
self._VtxCurrentIdx = idx + 4
end
-- [Luau] _AddRectBaked() taking p_min/p_max as scalars
@native
local function _AddRectBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, t, tex_uvs, flags)
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
local idx_allocated = 8 * 2 * 3
local vtx_allocated = 8 * 4
PrimReserve(self, idx_allocated, vtx_allocated)
local start_vtx_ptr = self._VtxWritePtr
local start_idx_ptr = self._IdxWritePtr
local round_tl = bit32.band(flags, 16 --[[ImDrawFlags.RoundTopLeft]]) ~= 0
local round_tr = bit32.band(flags, 32 --[[ImDrawFlags.RoundTopRight]]) ~= 0
local round_br = bit32.band(flags, 128 --[[ImDrawFlags.RoundBottomRight]]) ~= 0
local round_bl = bit32.band(flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) ~= 0
if round_tl then
AppendQuadUV(self,
p_min_x, p_min_y, uv_l, uv_t,
p_min_x + r, p_min_y, uv_r, uv_t,
p_min_x + r, p_min_y + r, uv_r, uv_b,
p_min_x, p_min_y + r, uv_l, uv_b, col)
end
if round_tr then
AppendQuadUV(self,
p_max_x - r, p_min_y, uv_r, uv_t,
p_max_x, p_min_y, uv_l, uv_t,
p_max_x, p_min_y + r, uv_l, uv_b,
p_max_x - r, p_min_y + r, uv_r, uv_b, col)
end
if round_br then
AppendQuadUV(self,
p_max_x - r, p_max_y - r, uv_r, uv_b,
p_max_x, p_max_y - r, uv_l, uv_b,
p_max_x, p_max_y, uv_l, uv_t,
p_max_x - r, p_max_y, uv_r, uv_t, col)
end
if round_bl then
AppendQuadUV(self,
p_min_x, p_max_y - r, uv_l, uv_b,
p_min_x + r, p_max_y - r, uv_r, uv_b,
p_min_x + r, p_max_y, uv_r, uv_t,
p_min_x, p_max_y, uv_l, uv_t, col)
end
local r_tl = round_tl and r or 0
local r_tr = round_tr and r or 0
local r_br = round_br and r or 0
local r_bl = round_bl and r or 0
local opaque_uv = self._Data.TexUvWhitePixel
local ou, ov = opaque_uv.x, opaque_uv.y
do
-- Top
local x0 = p_min_x + r_tl
local x1 = p_max_x - r_tr
AppendQuadUV(self, x0, p_min_y, ou, ov, x1, p_min_y, ou, ov, x1, p_min_y + t, ou, ov, x0, p_min_y + t, ou, ov, col)
end
do
-- Left
local y0 = p_min_y + ImMax(r_tl, t)
local y1 = p_max_y - ImMax(r_bl, t)
AppendQuadUV(self, p_min_x, y0, ou, ov, p_min_x + t, y0, ou, ov, p_min_x + t, y1, ou, ov, p_min_x, y1, ou, ov, col)
end
do
-- Right
local y0 = p_min_y + ImMax(r_tr, t)
local y1 = p_max_y - ImMax(r_br, t)
AppendQuadUV(self, p_max_x - t, y0, ou, ov, p_max_x, y0, ou, ov, p_max_x, y1, ou, ov, p_max_x - t, y1, ou, ov, col)
end
do
-- Bottom
local x0 = p_min_x + r_bl
local x1 = p_max_x - r_br
AppendQuadUV(self, x0, p_max_y - t, ou, ov, x1, p_max_y - t, ou, ov, x1, p_max_y, ou, ov, x0, p_max_y, ou, ov, col)
end
local idx_used = self._IdxWritePtr - start_idx_ptr
local vtx_used = self._VtxWritePtr - start_vtx_ptr
IM_ASSERT_PARANOID(idx_used <= idx_allocated and vtx_used <= vtx_allocated)
if idx_used < idx_allocated or vtx_used < vtx_allocated then
self:PrimUnreserve(idx_allocated - idx_used, vtx_allocated - vtx_used)
end
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param t float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectBaked(p_min, p_max, col, r, t, tex_uvs, flags)
_AddRectBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, t, tex_uvs, flags)
end
local corner_offset_x = { 1, -1, -1, 1 } -- static const ImVec2 corner_offset[4] = { {1,1}, {-1,1}, {-1,-1}, {1,-1} };
local corner_offset_y = { 1, 1, -1, -1 }
@@ -38897,7 +39186,18 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(8192 --[[ImDrawFlags.AALines]], 2097152 --[[ImDrawFlags.UseTexForRoundCorners]], 8388608 --[[ImDrawFlags.AllowTexForRoundCorners_]])
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_thickness < 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] and s_rounding <= 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] then
-- Pixel aligned rect with round corners rendered using baked textures.
IM_ASSERT_PARANOID(s_thickness > 0 and s_rounding > 0)
local size = ImMax(s_rounding, s_thickness) -- This is matching the baking calculations.
local idx = (s_thickness * 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]]) + s_rounding - 1
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
IM_ASSERT_PARANOID(idx >= 0 and idx < 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] * 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]])
_AddRectBakedXY(self, outer_min_x, outer_min_y, outer_max_x, outer_max_y, col, size * fringe_scale, thickness, self._Data.TexUvCorners[idx], flags)
return
end
end
if not has_rounding or bit32.band(flags, 496 --[[ImDrawFlags.RoundMask_]]) == 256 --[[ImDrawFlags.RoundNone]] then
@@ -38931,7 +39231,67 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectFilledBaked() (UseTexForRoundCorners) not ported yet, AddRectFilled() falls back to the geometry path.
-- [Luau] _AddRectFilledBaked() taking p_min/p_max as scalars
@native
local function _AddRectFilledBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, tex_uvs, flags)
-- 9-slice with corner mirroring
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
PrimReserve(self, 9 * 2 * 3, 4 * 4)
local r_tl = (bit32.band(flags, 16 --[[ImDrawFlags.RoundTopLeft]]) ~= 0) and r or 0.0
local r_tr = (bit32.band(flags, 32 --[[ImDrawFlags.RoundTopRight]]) ~= 0) and r or 0.0
local r_br = (bit32.band(flags, 128 --[[ImDrawFlags.RoundBottomRight]]) ~= 0) and r or 0.0
local r_bl = (bit32.band(flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) ~= 0) and r or 0.0
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, p_min_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 1, p_min_x + r_tl, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 2, p_max_x - r_tr, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 3, p_max_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 4, p_min_x, p_min_y + r_tl, uv_l, uv_b, col)
WV(vb, vw + 5, p_min_x + r_tl, p_min_y + r_tl, uv_r, uv_b, col)
WV(vb, vw + 6, p_max_x - r_tr, p_min_y + r_tr, uv_r, uv_b, col)
WV(vb, vw + 7, p_max_x, p_min_y + r_tr, uv_l, uv_b, col)
WV(vb, vw + 8, p_min_x, p_max_y - r_bl, uv_l, uv_b, col)
WV(vb, vw + 9, p_min_x + r_bl, p_max_y - r_bl, uv_r, uv_b, col)
WV(vb, vw + 10, p_max_x - r_br, p_max_y - r_br, uv_r, uv_b, col)
WV(vb, vw + 11, p_max_x, p_max_y - r_br, uv_l, uv_b, col)
WV(vb, vw + 12, p_min_x, p_max_y, uv_l, uv_t, col)
WV(vb, vw + 13, p_min_x + r_bl, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 14, p_max_x - r_br, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 15, p_max_x, p_max_y, uv_l, uv_t, col)
for _ = 0, 2 do
for _ = 0, 2 do
ib[iw + 0] = idx + 4; ib[iw + 1] = idx + 0; ib[iw + 2] = idx + 1
ib[iw + 3] = idx + 4; ib[iw + 4] = idx + 1; ib[iw + 5] = idx + 5
iw = iw + 6
idx = idx + 1
end
idx = idx + 1
end
self._VtxWritePtr = vw + 16
self._IdxWritePtr = iw
self._VtxCurrentIdx = self._VtxCurrentIdx + 16
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectFilledBaked(p_min, p_max, col, r, tex_uvs, flags)
_AddRectFilledBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, tex_uvs, flags)
end
--- @param p_min ImVec2
--- @param p_max ImVec2
@@ -39008,7 +39368,20 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectFilledBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(4096 --[[ImDrawFlags.AAFill]], 2097152 --[[ImDrawFlags.UseTexForRoundCorners]], 8388608 --[[ImDrawFlags.AllowTexForRoundCorners_]])
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_rounding <= 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] then
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
-- This is matching the baking calculations. The rounding clamping above makes sure that there's enough space for the extra pixel.
local corner_size = s_rounding + 1
-- Check that the baked corners do not overlap (this could be made more accurate if tested for x and y separately).
if corner_size * 2.0 * fringe_scale < min_dim then
local idx = (s_rounding - 1)
IM_ASSERT_PARANOID(idx >= 0 and idx < 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]])
_AddRectFilledBakedXY(self, ax, ay, bx, by, col, corner_size * fringe_scale, self._Data.TexUvCorners[idx], flags)
return
end
end
end
if not has_rounding then
@@ -77390,6 +77763,7 @@ IM_INCLUDE('imgui_demo.lua')
return {
BuildLoadGlyphGetAdvanceOrFallback = BuildLoadGlyphGetAdvanceOrFallback,
CalcCornerArcStepAndCount = CalcCornerArcStepAndCount,
CalcNextScrollFromScrollTargetAndClamp = CalcNextScrollFromScrollTargetAndClamp,
CustomConstraints = CustomConstraints,
DBL_MAX = DBL_MAX,
@@ -77521,6 +77895,7 @@ return {
IM_DELETE = IM_DELETE,
IM_DRAWLIST_ARCFAST_SAMPLE_MAX = IM_DRAWLIST_ARCFAST_SAMPLE_MAX,
IM_DRAWLIST_ARCFAST_TABLE_SIZE = IM_DRAWLIST_ARCFAST_TABLE_SIZE,
IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC,
IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX = IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX,
IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX = IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX,
IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH = IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH,
@@ -77604,6 +77979,7 @@ return {
ImFontAtlasBuildSetupFontSpecialGlyphs = ImFontAtlasBuildSetupFontSpecialGlyphs,
ImFontAtlasBuildUpdateTexData = ImFontAtlasBuildUpdateTexData,
ImFontAtlasBuildUpdateTexDataBasic = ImFontAtlasBuildUpdateTexDataBasic,
ImFontAtlasBuildUpdateTexDataCorners = ImFontAtlasBuildUpdateTexDataCorners,
ImFontAtlasBuildUpdateTexDataLines = ImFontAtlasBuildUpdateTexDataLines,
ImFontAtlasBuilder = ImFontAtlasBuilder,
ImFontAtlasFlags = ImFontAtlasFlags,
+1 -1
View File
@@ -1 +1 @@
[[183, "imgui.lua"], [21598, "imgui_demo.lua"], [33450, "imgui_draw.lua"], [40593, "imgui_h.lua"], [43499, "imgui_impl_love.lua"], [44039, "imgui_internal.lua"], [47748, "imgui_tables.lua"], [52807, "imgui_widgets.lua"], [64796, "imstb_rectpack.lua"], [65460, "imstb_textedit.lua"], [67002, "imstb_truetype.lua"], [69790, "imstd_minstdio.lua"]]
[[183, "imgui.lua"], [21598, "imgui_demo.lua"], [33450, "imgui_draw.lua"], [40966, "imgui_h.lua"], [43872, "imgui_impl_love.lua"], [44412, "imgui_internal.lua"], [48121, "imgui_tables.lua"], [53180, "imgui_widgets.lua"], [65169, "imstb_rectpack.lua"], [65833, "imstb_textedit.lua"], [67375, "imstb_truetype.lua"], [70163, "imstd_minstdio.lua"]]
+384 -8
View File
@@ -138,7 +138,7 @@ if not utf8 then
end
local ImGui, ImVec2, ImVec4, ImRect, HelpMarker, ImVec2_Copy, IMGUI_DEMO_MARKER, ImGuiTableFlags, ImStd, ImVector, ImGuiKey, ImDrawFlags, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImVec2_CopyV, ImGuiStyleVarInfo, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, IM_ASSERT_USER_ERROR_RET, ImHashStr, ImS32, ImGuiColorEditFlags, ImIsPowerOfTwo, ImAbs, ImVec4_Copy, ExampleAppConsoleMT, IM_ROUND, ImGuiTableColumnFlags, ImGuiTreeNodeFlags, PopStyleCompact, PushStyleCompact, ImU16, ExampleNames, ImGuiWindowFlags, ImGuiItemFlags, stbte, ImColor, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ExampleTreeFuncs, IM_ASSERT_PARANOID, ImCos, ImGuiListClipper, ImS16, _PathArcToFastExXY, ImGuiMultiSelectFlags, ImGuiTabBarFlags, ImSin, ImUpperPowerOfTwo, IM_F32_TO_INT8_SAT, ImFontAtlasPackGetRect, ImGuiMouseCursor, DockSettingsRenameNodeReferences, ExampleDualListBoxMT, IM_DRAWLIST_TEX_LINES_WIDTH_MAX, ImCeil, ImGuiCol, ImGuiSelectionBasicStorage, ImLengthSqr, ImS8, ImU8, ExampleAppPropertyEditorMT, ImFabs, ImGuiScrollFlags, ImGui_ImplLOVE_GetBackendData, ImLog, ExampleSelectionWithDeletionMT, CustomConstraints, ExampleAppLogMT, ImFontAtlasBuildInit, ImGuiComboFlags, ImGuiPopupFlags, ImGuiSliderFlags, ImTextClassifierSetCharClass, MyDocument, ShowExampleMenuFile, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ImGuiStyle_Copy, ExampleAsset_s_current_sort_specs, ExampleMemberInfo, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImFontAtlasTextureAdd, ImFontAtlasTextureBlockQueueUpload, ImFontBaked_BuildGrowIndex, ImFontConfig, ImFontGlyph, ImGuiTableColumn, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, IM_FREE, ImDrawListSplitter, ImGuiDragDropFlags, stb_text_locate_coord, stb_text_makeundo_insert, stb_text_makeundo_replace, stb_textedit_find_charpos, stbtt_GetGlyphShape, ImGuiTableColumnSortSpecs, ImGuiTableInstanceData, ImGuiTableSettings, stb_text_makeundo_delete, stb_text_redo, stb_text_undo, stb_textedit_click, stb_textedit_drag, stbtt_FindGlyphIndex, stbtt_GetFontOffsetForIndex, stbtt_GetFontVMetrics, stbtt_GetGlyphBitmapBox, stbtt_GetGlyphHMetrics, stbtt_InitFont, stbtt_MakeGlyphBitmapSubpixelPrefilter, stbtt_ScaleForPixelHeight, stbtt__GetGlyphInfoT2, stbtt__GetGlyphShapeT2, stbtt_fontinfo, ImGuiOldColumnData, ImGuiOldColumnFlags, ImGuiOldColumns, ImGuiTable, ImGuiTableColumnSettings, ImGuiTableSortSpecs, ImGuiTableTempData, ImGui_ImplLOVE_CreateTexture, ImGui_ImplLOVE_DestroyTexture, ImGui_ImplLOVE_Init, ImGui_ImplLOVE_NewFrame, ImGui_ImplLOVE_RenderDrawData, ImGui_ImplLOVE_Shutdown, ImGui_ImplLOVE_UpdateTexture, stbrp_init_target, IMGUI_TABLE_MAX_COLUMNS, IMSTB_TEXTEDIT_UNDOSTATECOUNT, IM_COL32_DISABLE, ImGui_ImplLove, STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_PGDOWN, STB_TEXTEDIT_K_PGUP, STB_TEXTEDIT_K_REDO, STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT, STB_TEXTEDIT_K_TEXTEND, STB_TEXTEDIT_K_TEXTSTART
local ImGui, ImVec2, ImVec4, ImRect, HelpMarker, ImVec2_Copy, IMGUI_DEMO_MARKER, ImGuiTableFlags, ImStd, ImVector, ImGuiKey, ImDrawFlags, ImGuiInputFlags, ImRect_Copy, ImGuiDataType, ImStb, IM_TRUNC, ImVec2_CopyV, ImGuiStyleVarInfo, IM_ASSERT_USER_ERROR, ImGuiHoveredFlags, ImFormatString, IM_ASSERT_USER_ERROR_RET, ImHashStr, ImS32, ImGuiColorEditFlags, ImIsPowerOfTwo, ImAbs, ImVec4_Copy, ExampleAppConsoleMT, IM_ROUND, ImGuiTableColumnFlags, ImGuiTreeNodeFlags, PopStyleCompact, PushStyleCompact, IM_ASSERT_PARANOID, ImU16, ExampleNames, ImGuiWindowFlags, ImGuiItemFlags, stbte, ImColor, ImCos, ImGuiButtonFlags, ImGuiDebugLogFlags, ImGuiLocKey, ImU32, ExampleTreeFuncs, ImGuiListClipper, ImS16, _PathArcToFastExXY, ImGuiMultiSelectFlags, ImSin, ImGuiTabBarFlags, ImUpperPowerOfTwo, IM_F32_TO_INT8_SAT, ImFontAtlasPackGetRect, ImGuiMouseCursor, DockSettingsRenameNodeReferences, ExampleDualListBoxMT, IM_DRAWLIST_TEX_LINES_WIDTH_MAX, ImCeil, ImGuiCol, ImGuiSelectionBasicStorage, ImLengthSqr, ImS8, ImU8, ExampleAppPropertyEditorMT, ImFabs, ImGuiScrollFlags, ImGui_ImplLOVE_GetBackendData, ImLog, ExampleSelectionWithDeletionMT, CustomConstraints, ExampleAppLogMT, ImFontAtlasBuildInit, ImGuiComboFlags, ImGuiPopupFlags, ImGuiSliderFlags, ImTextClassifierSetCharClass, MyDocument, ShowExampleMenuFile, CalcCornerArcStepAndCount, ImFontAtlasBakedAddFontGlyph, ImFontAtlasPackAddRect, ImFontBaked_BuildLoadGlyph, ImGuiInputTextFlags, ImGuiStyle_Copy, ExampleAsset_s_current_sort_specs, ExampleMemberInfo, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC, ImFontAtlasBuildRenderBitmapFromString, ImFontAtlasFontDestroyOutput, ImFontAtlasFontSourceAddToFont, ImFontAtlasFontSourceInit, ImFontAtlasTextureAdd, ImFontAtlasTextureBlockQueueUpload, ImFontBaked_BuildGrowIndex, ImGuiTableColumn, stb_textedit_key, stbtt_GetGlyphBitmapBoxSubpixel, IM_FREE, ImDrawListSplitter, ImGuiDragDropFlags, ImGuiFocusedFlags, stb_text_locate_coord, stb_text_makeundo_insert, stb_text_makeundo_replace, stb_textedit_find_charpos, stbtt_GetGlyphShape, IM_ALLOC, ImGuiTableColumnSortSpecs, ImGuiTableInstanceData, ImGuiTableSettings, stb_text_makeundo_delete, stb_text_redo, stb_text_undo, stb_textedit_click, stb_textedit_drag, stbtt_FindGlyphIndex, stbtt_GetFontOffsetForIndex, stbtt_GetFontVMetrics, stbtt_GetGlyphBitmapBox, stbtt_GetGlyphHMetrics, stbtt_InitFont, stbtt_MakeGlyphBitmapSubpixelPrefilter, stbtt_ScaleForPixelHeight, stbtt__GetGlyphInfoT2, stbtt__GetGlyphShapeT2, stbtt_fontinfo, ImGuiOldColumnData, ImGuiOldColumnFlags, ImGuiOldColumns, ImGuiTable, ImGuiTableColumnSettings, ImGuiTableSortSpecs, ImGuiTableTempData, ImGui_ImplLOVE_CreateTexture, ImGui_ImplLOVE_DestroyTexture, ImGui_ImplLOVE_Init, ImGui_ImplLOVE_NewFrame, ImGui_ImplLOVE_RenderDrawData, ImGui_ImplLOVE_Shutdown, ImGui_ImplLOVE_UpdateTexture, stbrp_init_target, IMGUI_TABLE_MAX_COLUMNS, IMSTB_TEXTEDIT_UNDOSTATECOUNT, IM_COL32_DISABLE, ImGui_ImplLove, STB_TEXTEDIT_K_BACKSPACE, STB_TEXTEDIT_K_DELETE, STB_TEXTEDIT_K_DOWN, STB_TEXTEDIT_K_LEFT, STB_TEXTEDIT_K_LINEEND, STB_TEXTEDIT_K_LINESTART, STB_TEXTEDIT_K_PGDOWN, STB_TEXTEDIT_K_PGUP, STB_TEXTEDIT_K_REDO, STB_TEXTEDIT_K_RIGHT, STB_TEXTEDIT_K_SHIFT
local type, mathMin, mathMax, mathFloor, mathCeil, bitOr, bitLShift = type, math.min, math.max, math.floor, math.ceil, bit32.bor, bit32.lshift
local function IM_COL32(R, G, B, A) return (bitOr(bitLShift(A, 24 --[[IM_COL32_A_SHIFT]]), bitLShift(B, 16 --[[IM_COL32_B_SHIFT]]), bitLShift(G, 8 --[[IM_COL32_G_SHIFT]]), bitLShift(R, 0 --[[IM_COL32_R_SHIFT]]))) end
@@ -33895,7 +33895,10 @@ local ImFontAtlasBakedGetClosestMatch
local ImFontAtlasBuildInit
local ImFontAtlasBuildSetTexture
local ImFontAtlasBuildUpdateTexDataLines
local ImFontAtlasBuildUpdateTexDataCorners
local ImFontAtlasBuildUpdateTexDataBasic
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC -- [Luau] forward declared, defined in [SECTION] ImDrawList
local CalcCornerArcStepAndCount -- [Luau] forward declared, defined in [SECTION] ImDrawList
local ImFontAtlasBuildSetupFontLoader
local ImFontAtlasBuildSetupFontSpecialGlyphs
local ImFontAtlasBuildSetupFontBakedBlanks
@@ -35401,7 +35404,7 @@ end
function ImFontAtlasBuildUpdateTexData(atlas)
ImFontAtlasBuildUpdateTexDataBasic(atlas)
ImFontAtlasBuildUpdateTexDataLines(atlas)
-- [Port] TODO baked round corners: ImFontAtlasBuildUpdateTexDataCorners(atlas)
ImFontAtlasBuildUpdateTexDataCorners(atlas)
end
-- Create a new texture, discard previous one
@@ -35525,6 +35528,176 @@ function ImFontAtlasPackInit(atlas)
end
--- @param atlas ImFontAtlas
-- #define IM_DRAWLIST_CORNER_POINTS_MAX (IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4 + 3) // Max number of points in corner profiles
-- [Luau] ImVec2 line_normals[] / float line_distances[] / ImVec2 points[] are flat 1-based scratch arrays (x, y, distance).
local corner_points_x, corner_points_y = {}, {}
local corner_normals_x, corner_normals_y, corner_distances = {}, {}, {}
-- [Luau] line_normals is passed as two arrays (line_normals_x, line_normals_y), 1-based.
local function InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- This tries to quite faithfully replicate how we render the corners using tessellation.
-- Older code sampled a circle SDF directly, but it had clearly visible discrepancy between the baked corners
-- and tessellated corners due to circle_segment_max_error.
local auto_seg_count = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(rounding, circle_segment_max_error)
local arc_step, arc_step_count = CalcCornerArcStepAndCount(auto_seg_count)
local arc_point_count = arc_step_count + 1
-- Build arc of points, with straight segments at each end.
-- . [n-2]..[n-1]
-- .`
-- .
-- [1] x (cx,cy)
-- :
-- [0]
local points_x, points_y = corner_points_x, corner_points_y
local num_points = 0
num_points = num_points + 1; points_x[num_points] = cx - rounding; points_y[num_points] = cy + 1.0
local da = (arc_step / 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]]) * 3.141592653589793 --[[IM_PI]] * 2.0
local a = 3.141592653589793 --[[IM_PI]]
for _ = 0, arc_point_count - 1 do
local dx = ImCos(a)
local dy = ImSin(a)
num_points = num_points + 1; points_x[num_points] = cx + dx * rounding; points_y[num_points] = cy + dy * rounding
a = a + da
end
num_points = num_points + 1; points_x[num_points] = cx + 1.0; points_y[num_points] = cy - rounding
-- Turn segments to half spaces.
for i = 1, num_points - 1 do
local diff_x = points_x[i + 1] - points_x[i]
local diff_y = points_y[i + 1] - points_y[i]
local d2 = diff_x * diff_x + diff_y * diff_y
local inv_d = ImRsqrtPrecise(d2)
line_normals_x[i] = diff_y * inv_d -- Normal points outwards
line_normals_y[i] = -diff_x * inv_d
line_distances[i] = -(points_x[i] * line_normals_x[i] + points_y[i] * line_normals_y[i]) -- -ImDot()
end
return num_points - 1
end
-- Returns distance to convex shape limited by lines.
local function SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local result = -3.4028234663853e+38 --[[FLT_MAX]]
for i = 1, num_lines do
local d = line_normals_x[i] * x + line_normals_y[i] * y + line_distances[i]
if d > result then
result = d
end
end
return result
end
local function SampleCornerFillOrStroke(x, y, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
local d = SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local aa_width = 1.0
if thickness == 0.0 then
-- Fill
return math.floor(ImClamp(1.0 - (d + aa_width * 0.5) / aa_width, 0.0, 1.0) * 255.0) -- (ImU8)
else
-- Stroke
local outer = 1.0 - (d + aa_width * 0.5) / aa_width
local inner = (d + thickness + aa_width * 0.5) / aa_width
return math.floor(ImClamp(ImMin(inner, outer), 0.0, 1.0) * 255.0) -- (ImU8)
end
end
-- [Port] #if 0 DEBUG_TEX_CORNER_U8/DEBUG_TEX_CORNER_U32 coverage visualization not ported (always 0xFF/0xFFFFFFFF).
function ImFontAtlasBuildUpdateTexDataCorners(atlas)
if bit32.band(atlas.Flags, 8 --[[ImFontAtlasFlags.NoBakedRoundCorners]]) ~= 0 then
return
end
-- Pack and store identifier so we can refresh UV coordinates on texture resize.
local tex = atlas.TexData
local builder = atlas.Builder
-- FIXME-TEXCORNERS: Ideally we should pick up the max error from the styles, but it does not seem be to set by the time we build the data the first time.
local circle_segment_max_error = 0.30 -- Default matching ImGuiStyle::CircleTessellationMaxError.
-- if (atlas->OwnerContext)
-- circle_segment_max_error = atlas->OwnerContext->DrawListSharedData.CircleSegmentMaxError;
-- Calculate size and pack
local r = ImFontAtlasRect()
local add_and_draw = (atlas:GetCustomRect(builder.PackIdCornersTexData, r) == false)
if add_and_draw then
-- (thickness 0 for filled, thickness >0 for strokes)
local pack_size_x, pack_size_y = 0, 0 -- ImVec2i
for thickness = 0, 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] - 1 do
local is_filled = (thickness == 0)
local row_width = 0
local row_height = 0
for n = 0, 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] - 1 do
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
row_width = row_width + size + 2
row_height = ImMax(row_height, size + 2)
end
pack_size_x = ImMax(pack_size_x, row_width)
pack_size_y = pack_size_y + row_height
end
builder.PackIdCornersTexData = atlas:AddCustomRect(pack_size_x, pack_size_y, r)
assert(builder.PackIdCornersTexData ~= (-1) --[[ImFontAtlasRectId_Invalid]])
end
-- Render
local y = r.y
local line_normals_x, line_normals_y, line_distances = corner_normals_x, corner_normals_y, corner_distances
for thickness = 0, 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] - 1 do
local is_filled = (thickness == 0)
local x = r.x
local row_height = 0
for n = 0, 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] - 1 do
-- Filled: Always add 1px to the fill side of the rounded corner to prevent the corner AA to bleed into the rectangle edges.
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
local w = size + 2
local h = size + 2
-- Corner circle
local cx = 1.0 + (n + 1)
local cy = 1.0 + (n + 1)
assert((x + w) <= (r.x + r.w) and (y + h) <= (r.y + r.h)) -- Make sure we're inside the texture bounds
local num_lines = InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- Write each slice
if add_and_draw and tex.Format == 1 --[[ImTextureFormat.Alpha8]] then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_ptr[write_ptr_base + lx] = SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
end
write_ptr_base = write_ptr_base + pitch
end
elseif add_and_draw and tex.Format == 0 --[[ImTextureFormat.RGBA32]] then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width * 4
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_u32(write_ptr, write_ptr_base + lx * 4, IM_COL32(255, 255, 255, SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)))
end
write_ptr_base = write_ptr_base + pitch
end
end
-- Refresh UV coordinates
local uv0_x, uv0_y = (x + 1) * atlas.TexUvScale.x, (y + 1) * atlas.TexUvScale.y
local uv1_x, uv1_y = (x + 1 + size) * atlas.TexUvScale.x, (y + 1 + size) * atlas.TexUvScale.y
builder.TexUvCorners[n + thickness * 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]]] = ImVec4(uv0_x, uv0_y, uv1_x, uv1_y)
x = x + w
row_height = ImMax(row_height, h)
end
y = y + row_height
end
end
function ImFontAtlasBuildUpdateTexDataLines(atlas)
if bit32.band(atlas.Flags, 4 --[[ImFontAtlasFlags.NoBakedLines]]) ~= 0 then
return
@@ -35732,6 +35905,7 @@ function ImFontAtlasUpdateDrawListsSharedData(atlas)
if (shared_data.FontAtlas == atlas) then
shared_data.TexUvWhitePixel = atlas.TexUvWhitePixel
shared_data.TexUvLines = atlas.Builder.TexUvLines
shared_data.TexUvCorners = atlas.Builder.TexUvCorners
end
end
end
@@ -37163,13 +37337,13 @@ end
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN = 4
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX = 512
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(3.141592653589793 --[[IM_PI]] / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]])))) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(3.141592653589793 --[[IM_PI]] / ImMax(_N, 3.141592653589793 --[[IM_PI]]))) / _RAD) end
-- Calculates arc step and step count for 90 degree arc. The calculated arc step will complete a 90 degree arc when stepped arc_step_count times.
-- [Luau] returns arc_step, arc_step_count (C++ out-references)
local function CalcCornerArcStepAndCount(segment_count)
function CalcCornerArcStepAndCount(segment_count)
local quarter = 48 --[[IM_DRAWLIST_ARCFAST_TABLE_SIZE]] / 4
local arc_step = ImClamp(math.floor(48 --[[IM_DRAWLIST_ARCFAST_SAMPLE_MAX]] / segment_count), 1, quarter)
local arc_step_count = math.floor(quarter / arc_step)
@@ -38778,7 +38952,122 @@ function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectBaked() (UseTexForRoundCorners) not ported yet, AddRect() falls back to the geometry path.
-- [Luau] IM_APPEND_VTX() x4 + IM_APPEND_TRI(idx + 0, idx + 1, idx + 2) + IM_APPEND_TRI(idx + 0, idx + 2, idx + 3)
local function AppendQuadUV(self, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, col)
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, x0, y0, u0, v0, col)
WV(vb, vw + 1, x1, y1, u1, v1, col)
WV(vb, vw + 2, x2, y2, u2, v2, col)
WV(vb, vw + 3, x3, y3, u3, v3, col)
ib[iw + 0] = idx + 0; ib[iw + 1] = idx + 1; ib[iw + 2] = idx + 2
ib[iw + 3] = idx + 0; ib[iw + 4] = idx + 2; ib[iw + 5] = idx + 3
self._VtxWritePtr = vw + 4
self._IdxWritePtr = iw + 6
self._VtxCurrentIdx = idx + 4
end
-- [Luau] _AddRectBaked() taking p_min/p_max as scalars
local function _AddRectBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, t, tex_uvs, flags)
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
local idx_allocated = 8 * 2 * 3
local vtx_allocated = 8 * 4
PrimReserve(self, idx_allocated, vtx_allocated)
local start_vtx_ptr = self._VtxWritePtr
local start_idx_ptr = self._IdxWritePtr
local round_tl = bit32.band(flags, 16 --[[ImDrawFlags.RoundTopLeft]]) ~= 0
local round_tr = bit32.band(flags, 32 --[[ImDrawFlags.RoundTopRight]]) ~= 0
local round_br = bit32.band(flags, 128 --[[ImDrawFlags.RoundBottomRight]]) ~= 0
local round_bl = bit32.band(flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) ~= 0
if round_tl then
AppendQuadUV(self,
p_min_x, p_min_y, uv_l, uv_t,
p_min_x + r, p_min_y, uv_r, uv_t,
p_min_x + r, p_min_y + r, uv_r, uv_b,
p_min_x, p_min_y + r, uv_l, uv_b, col)
end
if round_tr then
AppendQuadUV(self,
p_max_x - r, p_min_y, uv_r, uv_t,
p_max_x, p_min_y, uv_l, uv_t,
p_max_x, p_min_y + r, uv_l, uv_b,
p_max_x - r, p_min_y + r, uv_r, uv_b, col)
end
if round_br then
AppendQuadUV(self,
p_max_x - r, p_max_y - r, uv_r, uv_b,
p_max_x, p_max_y - r, uv_l, uv_b,
p_max_x, p_max_y, uv_l, uv_t,
p_max_x - r, p_max_y, uv_r, uv_t, col)
end
if round_bl then
AppendQuadUV(self,
p_min_x, p_max_y - r, uv_l, uv_b,
p_min_x + r, p_max_y - r, uv_r, uv_b,
p_min_x + r, p_max_y, uv_r, uv_t,
p_min_x, p_max_y, uv_l, uv_t, col)
end
local r_tl = round_tl and r or 0
local r_tr = round_tr and r or 0
local r_br = round_br and r or 0
local r_bl = round_bl and r or 0
local opaque_uv = self._Data.TexUvWhitePixel
local ou, ov = opaque_uv.x, opaque_uv.y
do
-- Top
local x0 = p_min_x + r_tl
local x1 = p_max_x - r_tr
AppendQuadUV(self, x0, p_min_y, ou, ov, x1, p_min_y, ou, ov, x1, p_min_y + t, ou, ov, x0, p_min_y + t, ou, ov, col)
end
do
-- Left
local y0 = p_min_y + ImMax(r_tl, t)
local y1 = p_max_y - ImMax(r_bl, t)
AppendQuadUV(self, p_min_x, y0, ou, ov, p_min_x + t, y0, ou, ov, p_min_x + t, y1, ou, ov, p_min_x, y1, ou, ov, col)
end
do
-- Right
local y0 = p_min_y + ImMax(r_tr, t)
local y1 = p_max_y - ImMax(r_br, t)
AppendQuadUV(self, p_max_x - t, y0, ou, ov, p_max_x, y0, ou, ov, p_max_x, y1, ou, ov, p_max_x - t, y1, ou, ov, col)
end
do
-- Bottom
local x0 = p_min_x + r_bl
local x1 = p_max_x - r_br
AppendQuadUV(self, x0, p_max_y - t, ou, ov, x1, p_max_y - t, ou, ov, x1, p_max_y, ou, ov, x0, p_max_y, ou, ov, col)
end
local idx_used = self._IdxWritePtr - start_idx_ptr
local vtx_used = self._VtxWritePtr - start_vtx_ptr
IM_ASSERT_PARANOID(idx_used <= idx_allocated and vtx_used <= vtx_allocated)
if idx_used < idx_allocated or vtx_used < vtx_allocated then
self:PrimUnreserve(idx_allocated - idx_used, vtx_allocated - vtx_used)
end
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param t float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectBaked(p_min, p_max, col, r, t, tex_uvs, flags)
_AddRectBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, t, tex_uvs, flags)
end
local corner_offset_x = { 1, -1, -1, 1 } -- static const ImVec2 corner_offset[4] = { {1,1}, {-1,1}, {-1,-1}, {1,-1} };
local corner_offset_y = { 1, 1, -1, -1 }
@@ -39034,7 +39323,18 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(8192 --[[ImDrawFlags.AALines]], 2097152 --[[ImDrawFlags.UseTexForRoundCorners]], 8388608 --[[ImDrawFlags.AllowTexForRoundCorners_]])
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_thickness < 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]] and s_rounding <= 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] then
-- Pixel aligned rect with round corners rendered using baked textures.
IM_ASSERT_PARANOID(s_thickness > 0 and s_rounding > 0)
local size = ImMax(s_rounding, s_thickness) -- This is matching the baking calculations.
local idx = (s_thickness * 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]]) + s_rounding - 1
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
IM_ASSERT_PARANOID(idx >= 0 and idx < 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] * 4 --[[IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX]])
_AddRectBakedXY(self, outer_min_x, outer_min_y, outer_max_x, outer_max_y, col, size * fringe_scale, thickness, self._Data.TexUvCorners[idx], flags)
return
end
end
if not has_rounding or bit32.band(flags, 496 --[[ImDrawFlags.RoundMask_]]) == 256 --[[ImDrawFlags.RoundNone]] then
@@ -39068,7 +39368,67 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectFilledBaked() (UseTexForRoundCorners) not ported yet, AddRectFilled() falls back to the geometry path.
-- [Luau] _AddRectFilledBaked() taking p_min/p_max as scalars
local function _AddRectFilledBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, tex_uvs, flags)
-- 9-slice with corner mirroring
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
PrimReserve(self, 9 * 2 * 3, 4 * 4)
local r_tl = (bit32.band(flags, 16 --[[ImDrawFlags.RoundTopLeft]]) ~= 0) and r or 0.0
local r_tr = (bit32.band(flags, 32 --[[ImDrawFlags.RoundTopRight]]) ~= 0) and r or 0.0
local r_br = (bit32.band(flags, 128 --[[ImDrawFlags.RoundBottomRight]]) ~= 0) and r or 0.0
local r_bl = (bit32.band(flags, 64 --[[ImDrawFlags.RoundBottomLeft]]) ~= 0) and r or 0.0
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, p_min_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 1, p_min_x + r_tl, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 2, p_max_x - r_tr, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 3, p_max_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 4, p_min_x, p_min_y + r_tl, uv_l, uv_b, col)
WV(vb, vw + 5, p_min_x + r_tl, p_min_y + r_tl, uv_r, uv_b, col)
WV(vb, vw + 6, p_max_x - r_tr, p_min_y + r_tr, uv_r, uv_b, col)
WV(vb, vw + 7, p_max_x, p_min_y + r_tr, uv_l, uv_b, col)
WV(vb, vw + 8, p_min_x, p_max_y - r_bl, uv_l, uv_b, col)
WV(vb, vw + 9, p_min_x + r_bl, p_max_y - r_bl, uv_r, uv_b, col)
WV(vb, vw + 10, p_max_x - r_br, p_max_y - r_br, uv_r, uv_b, col)
WV(vb, vw + 11, p_max_x, p_max_y - r_br, uv_l, uv_b, col)
WV(vb, vw + 12, p_min_x, p_max_y, uv_l, uv_t, col)
WV(vb, vw + 13, p_min_x + r_bl, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 14, p_max_x - r_br, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 15, p_max_x, p_max_y, uv_l, uv_t, col)
for _ = 0, 2 do
for _ = 0, 2 do
ib[iw + 0] = idx + 4; ib[iw + 1] = idx + 0; ib[iw + 2] = idx + 1
ib[iw + 3] = idx + 4; ib[iw + 4] = idx + 1; ib[iw + 5] = idx + 5
iw = iw + 6
idx = idx + 1
end
idx = idx + 1
end
self._VtxWritePtr = vw + 16
self._IdxWritePtr = iw
self._VtxCurrentIdx = self._VtxCurrentIdx + 16
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectFilledBaked(p_min, p_max, col, r, tex_uvs, flags)
_AddRectFilledBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, tex_uvs, flags)
end
--- @param p_min ImVec2
--- @param p_max ImVec2
@@ -39145,7 +39505,20 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectFilledBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(4096 --[[ImDrawFlags.AAFill]], 2097152 --[[ImDrawFlags.UseTexForRoundCorners]], 8388608 --[[ImDrawFlags.AllowTexForRoundCorners_]])
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_rounding <= 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]] then
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
-- This is matching the baking calculations. The rounding clamping above makes sure that there's enough space for the extra pixel.
local corner_size = s_rounding + 1
-- Check that the baked corners do not overlap (this could be made more accurate if tested for x and y separately).
if corner_size * 2.0 * fringe_scale < min_dim then
local idx = (s_rounding - 1)
IM_ASSERT_PARANOID(idx >= 0 and idx < 16 --[[IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX]])
_AddRectFilledBakedXY(self, ax, ay, bx, by, col, corner_size * fringe_scale, self._Data.TexUvCorners[idx], flags)
return
end
end
end
if not has_rounding then
@@ -70016,6 +70389,7 @@ IM_INCLUDE('imgui_demo.lua')
return {
BuildLoadGlyphGetAdvanceOrFallback = BuildLoadGlyphGetAdvanceOrFallback,
CalcCornerArcStepAndCount = CalcCornerArcStepAndCount,
CalcNextScrollFromScrollTargetAndClamp = CalcNextScrollFromScrollTargetAndClamp,
CustomConstraints = CustomConstraints,
DBL_MAX = DBL_MAX,
@@ -70147,6 +70521,7 @@ return {
IM_DELETE = IM_DELETE,
IM_DRAWLIST_ARCFAST_SAMPLE_MAX = IM_DRAWLIST_ARCFAST_SAMPLE_MAX,
IM_DRAWLIST_ARCFAST_TABLE_SIZE = IM_DRAWLIST_ARCFAST_TABLE_SIZE,
IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC,
IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX = IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX,
IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX = IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX,
IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH = IM_DRAWLIST_TEX_LINES_DETAILED_WIDTH,
@@ -70230,6 +70605,7 @@ return {
ImFontAtlasBuildSetupFontSpecialGlyphs = ImFontAtlasBuildSetupFontSpecialGlyphs,
ImFontAtlasBuildUpdateTexData = ImFontAtlasBuildUpdateTexData,
ImFontAtlasBuildUpdateTexDataBasic = ImFontAtlasBuildUpdateTexDataBasic,
ImFontAtlasBuildUpdateTexDataCorners = ImFontAtlasBuildUpdateTexDataCorners,
ImFontAtlasBuildUpdateTexDataLines = ImFontAtlasBuildUpdateTexDataLines,
ImFontAtlasBuilder = ImFontAtlasBuilder,
ImFontAtlasFlags = ImFontAtlasFlags,
+206 -206
View File
@@ -14,14 +14,14 @@ polyline stroker (AddPolyline), Lua-native replacements (ImGuiStorage, ImStr*, I
upstream file funcs ported by size similarity stubs
imgui.cpp 786 87.4% 93.5% 75.1% 2
imgui_widgets.cpp 308 93.8% 98.7% 78.1% 1
imgui_draw.cpp 258 79.5% 86.2% 62.8% 2
imgui_draw.cpp 258 81.8% 92.3% 61.0% 2
imgui_tables.cpp 113 96.5% 99.0% 74.0% 0
imgui_demo.cpp 56 100.0% 100.0% 55.8% 0
imgui.h 110 53.6% 37.4% 60.0% 0
imgui_internal.h 269 62.5% 65.7% 67.6% 1
TOTAL 1900 82.8% 94.5% 70.6% 6
TOTAL 1900 83.1% 95.3% 70.3% 6
upstream code reproduced (similarity x ported size / all upstream size): 66.7%
upstream code reproduced (similarity x ported size / all upstream size): 67.0%
Public API (imgui.h, namespace ImGui) 368 / 376 97.9%
Internal API (imgui_internal.h, namespace ImGui) 417 / 443 94.1%
Enum values (imgui.h + imgui_internal.h) 1034 / 1078 95.9%
@@ -1275,80 +1275,80 @@ imgui_draw.cpp
-- ImDrawList
[x] 30% ImDrawListSharedData::ImDrawListSharedData imgui_internal.lua:1120
[-] ImDrawListSharedData::~ImDrawListSharedData c++-only
[x] 57% ImDrawListSharedData::SetCircleTessellationMaxError imgui_draw.lua:3744
[x] 57% ImDrawListSharedData::SetCircleTessellationMaxError imgui_draw.lua:3918
[x] 6% ImDrawList::ImDrawList imgui_h.lua:657
[-] ImDrawList::~ImDrawList c++-only
[x] 88% ImDrawList::_SetDrawListSharedData imgui_draw.lua:3761
[x] 43% ImDrawList::_ResetForNewFrame imgui_draw.lua:3774
[x] 64% ImDrawList::_ClearFreeMemory imgui_draw.lua:3802
[x] 88% ImDrawList::_SetDrawListSharedData imgui_draw.lua:3935
[x] 43% ImDrawList::_ResetForNewFrame imgui_draw.lua:3948
[x] 64% ImDrawList::_ClearFreeMemory imgui_draw.lua:3976
[ ] ImDrawList::CloneOutput
[x] 77% ImDrawList::AddDrawCmd imgui_draw.lua:3821
[x] 88% ImDrawList::_PopUnusedDrawCmd imgui_draw.lua:3838
[x] 57% ImDrawList::AddCallback imgui_draw.lua:3852
[x] 42% ImDrawList::_TryMergeDrawCmds imgui_draw.lua:3927
[x] 33% ImDrawList::_OnChangedClipRect imgui_draw.lua:3939
[x] 55% ImDrawList::_OnChangedTexture imgui_draw.lua:3966
[x] 91% ImDrawList::_OnChangedVtxOffset imgui_draw.lua:3992
[x] 57% ImDrawList::_CalcCircleAutoSegmentCount imgui_draw.lua:6209
[x] 86% ImDrawList::PushClipRect imgui_draw.lua:6221
[x] 60% ImDrawList::PushClipRectFullScreen imgui_draw.lua:6244
[x] 39% ImDrawList::PopClipRect imgui_draw.lua:6249
[x] 67% ImDrawList::PushTexture imgui_draw.lua:4208
[x] 81% ImDrawList::PopTexture imgui_draw.lua:4217
[x] 62% ImDrawList::PushDrawFlag imgui_draw.lua:4226
[x] 85% ImDrawList::PopDrawFlag imgui_draw.lua:4238
[x] 83% ImDrawList::_SetTexture imgui_draw.lua:4245
[x] 89% ImDrawList::_SetPixelDensity imgui_draw.lua:4255
[x] 57% ImDrawList::PrimReserve imgui_draw.lua:4295 = PrimReserve
[x] 68% ImDrawList::PrimUnreserve imgui_draw.lua:4298
[x] 8% ImDrawList::PrimRect imgui_draw.lua:4345
[x] 13% ImDrawList::PrimRectUV imgui_draw.lua:4354
[x] 77% ImDrawList::AddDrawCmd imgui_draw.lua:3995
[x] 88% ImDrawList::_PopUnusedDrawCmd imgui_draw.lua:4012
[x] 57% ImDrawList::AddCallback imgui_draw.lua:4026
[x] 42% ImDrawList::_TryMergeDrawCmds imgui_draw.lua:4101
[x] 33% ImDrawList::_OnChangedClipRect imgui_draw.lua:4113
[x] 55% ImDrawList::_OnChangedTexture imgui_draw.lua:4140
[x] 91% ImDrawList::_OnChangedVtxOffset imgui_draw.lua:4166
[x] 57% ImDrawList::_CalcCircleAutoSegmentCount imgui_draw.lua:6582
[x] 86% ImDrawList::PushClipRect imgui_draw.lua:6594
[x] 60% ImDrawList::PushClipRectFullScreen imgui_draw.lua:6617
[x] 39% ImDrawList::PopClipRect imgui_draw.lua:6622
[x] 67% ImDrawList::PushTexture imgui_draw.lua:4382
[x] 81% ImDrawList::PopTexture imgui_draw.lua:4391
[x] 62% ImDrawList::PushDrawFlag imgui_draw.lua:4400
[x] 85% ImDrawList::PopDrawFlag imgui_draw.lua:4412
[x] 83% ImDrawList::_SetTexture imgui_draw.lua:4419
[x] 89% ImDrawList::_SetPixelDensity imgui_draw.lua:4429
[x] 57% ImDrawList::PrimReserve imgui_draw.lua:4469 = PrimReserve
[x] 68% ImDrawList::PrimUnreserve imgui_draw.lua:4472
[x] 8% ImDrawList::PrimRect imgui_draw.lua:4519
[x] 13% ImDrawList::PrimRectUV imgui_draw.lua:4528
[ ] ImDrawList::PrimQuadUV
[x] 83% ImDrawList::_CalculateCenterBiasedOffset imgui_draw.lua:4392 = _CalculateCenterBiasedOffset
[x] 77% ImAlphaMultiply imgui_draw.lua:3656
[x] 72% ImDrawList::_SelectLineTexture imgui_draw.lua:4427 = _SelectLineTexture
[x] 37% ImDrawList::_AddPolyline imgui_draw.lua:4440
[x] 43% ImDrawList::AddConvexPolyFilled imgui_draw.lua:4810
[x] 59% CalcCornerArcStepAndCount imgui_draw.lua:3723
[x] 64% ImDrawList::_PathArcToFastEx imgui_draw.lua:6368
[x] 63% ImDrawList::_PathArcToN imgui_draw.lua:6388
[x] 10% ImDrawList::PathArcToFast imgui_draw.lua:6374
[x] 46% ImDrawList::PathArcTo imgui_draw.lua:6414
[x] 61% ImDrawList::PathEllipticalArcTo imgui_draw.lua:7011
[x] 88% ImBezierCubicCalc imgui_draw.lua:7023
[x] 89% ImBezierQuadraticCalc imgui_draw.lua:7029
[x] 85% PathBezierCubicCurveToCasteljau imgui_draw.lua:7036
[x] 90% PathBezierQuadraticCurveToCasteljau imgui_draw.lua:7054
[x] 91% ImDrawList::PathBezierCubicCurveTo imgui_draw.lua:7068
[x] 90% ImDrawList::PathBezierQuadraticCurveTo imgui_draw.lua:7080
[x] 8% ImDrawList::PathRect imgui_draw.lua:5060
[x] 46% ImDrawList::_AddLine imgui_draw.lua:5192
[x] 4% ImDrawList::AddLine imgui_draw.lua:5201
[x] 9% ImDrawList::AddLineH imgui_draw.lua:5229
[x] 9% ImDrawList::AddLineV imgui_draw.lua:5285
[ ] ImDrawList::_AddRectBaked
[x] 42% ImDrawList::_AddRectTinyRounding imgui_draw.lua:5347
[x] 15% ImDrawList::AddRect imgui_draw.lua:5473
[ ] ImDrawList::_AddRectFilledBaked
[x] 13% ImDrawList::AddRectFilled imgui_draw.lua:5630
[x] 26% ImDrawList::AddRectFilledMultiColor imgui_draw.lua:5723
[x] 59% ImDrawList::AddQuad imgui_draw.lua:5746
[x] 71% ImDrawList::AddQuadFilled imgui_draw.lua:5763
[x] 59% ImDrawList::AddTriangle imgui_draw.lua:5775
[x] 73% ImDrawList::AddTriangleFilled imgui_draw.lua:5792
[x] 100% ApproxApothem imgui_draw.lua:3733
[x] 47% ImDrawList::AddCircle imgui_draw.lua:5808
[x] 32% ImDrawList::AddCircleFilled imgui_draw.lua:5873
[x] 86% ImDrawList::AddNgon imgui_draw.lua:5911
[x] 95% ImDrawList::AddNgonFilled imgui_draw.lua:5959
[x] 80% ImDrawList::AddEllipse imgui_draw.lua:5984
[x] 88% ImDrawList::AddEllipseFilled imgui_draw.lua:6021
[x] 73% ImDrawList::AddBezierCubic imgui_draw.lua:6062
[x] 71% ImDrawList::AddBezierQuadratic imgui_draw.lua:6078
[x] 65% ImDrawList::AddText imgui_draw.lua:6103
[x] 69% ImDrawList::AddImage imgui_draw.lua:6146
[x] 83% ImDrawList::_CalculateCenterBiasedOffset imgui_draw.lua:4566 = _CalculateCenterBiasedOffset
[x] 77% ImAlphaMultiply imgui_draw.lua:3830
[x] 72% ImDrawList::_SelectLineTexture imgui_draw.lua:4601 = _SelectLineTexture
[x] 37% ImDrawList::_AddPolyline imgui_draw.lua:4614
[x] 43% ImDrawList::AddConvexPolyFilled imgui_draw.lua:4984
[x] 59% CalcCornerArcStepAndCount imgui_draw.lua:3897
[x] 64% ImDrawList::_PathArcToFastEx imgui_draw.lua:6741
[x] 63% ImDrawList::_PathArcToN imgui_draw.lua:6761
[x] 10% ImDrawList::PathArcToFast imgui_draw.lua:6747
[x] 46% ImDrawList::PathArcTo imgui_draw.lua:6787
[x] 61% ImDrawList::PathEllipticalArcTo imgui_draw.lua:7384
[x] 88% ImBezierCubicCalc imgui_draw.lua:7396
[x] 89% ImBezierQuadraticCalc imgui_draw.lua:7402
[x] 85% PathBezierCubicCurveToCasteljau imgui_draw.lua:7409
[x] 90% PathBezierQuadraticCurveToCasteljau imgui_draw.lua:7427
[x] 91% ImDrawList::PathBezierCubicCurveTo imgui_draw.lua:7441
[x] 90% ImDrawList::PathBezierQuadraticCurveTo imgui_draw.lua:7453
[x] 8% ImDrawList::PathRect imgui_draw.lua:5234
[x] 46% ImDrawList::_AddLine imgui_draw.lua:5366
[x] 4% ImDrawList::AddLine imgui_draw.lua:5375
[x] 9% ImDrawList::AddLineH imgui_draw.lua:5403
[x] 9% ImDrawList::AddLineV imgui_draw.lua:5459
[x] 18% ImDrawList::_AddRectBaked imgui_draw.lua:5619
[x] 42% ImDrawList::_AddRectTinyRounding imgui_draw.lua:5636
[x] 12% ImDrawList::AddRect imgui_draw.lua:5762
[x] 10% ImDrawList::_AddRectFilledBaked imgui_draw.lua:5980
[x] 11% ImDrawList::AddRectFilled imgui_draw.lua:5990
[x] 26% ImDrawList::AddRectFilledMultiColor imgui_draw.lua:6096
[x] 59% ImDrawList::AddQuad imgui_draw.lua:6119
[x] 71% ImDrawList::AddQuadFilled imgui_draw.lua:6136
[x] 59% ImDrawList::AddTriangle imgui_draw.lua:6148
[x] 73% ImDrawList::AddTriangleFilled imgui_draw.lua:6165
[x] 100% ApproxApothem imgui_draw.lua:3907
[x] 47% ImDrawList::AddCircle imgui_draw.lua:6181
[x] 32% ImDrawList::AddCircleFilled imgui_draw.lua:6246
[x] 86% ImDrawList::AddNgon imgui_draw.lua:6284
[x] 95% ImDrawList::AddNgonFilled imgui_draw.lua:6332
[x] 80% ImDrawList::AddEllipse imgui_draw.lua:6357
[x] 88% ImDrawList::AddEllipseFilled imgui_draw.lua:6394
[x] 73% ImDrawList::AddBezierCubic imgui_draw.lua:6435
[x] 71% ImDrawList::AddBezierQuadratic imgui_draw.lua:6451
[x] 65% ImDrawList::AddText imgui_draw.lua:6476
[x] 69% ImDrawList::AddImage imgui_draw.lua:6519
[ ] ImDrawList::AddImageQuad
[x] 84% ImDrawList::AddImageRounded imgui_draw.lua:6176
[x] 84% ImDrawList::AddImageRounded imgui_draw.lua:6549
-- ImTriangulator, ImDrawList concave polygon fill
[ ] ImTriangulatorNode::Unlink
@@ -1364,18 +1364,18 @@ imgui_draw.cpp
[ ] ImTriangulator::FlipNodeList
[ ] ImTriangulator::IsEar
[ ] ImTriangulator::ReclassifyNode
[x] 17% ImDrawList::AddConcavePolyFilled imgui_draw.lua:7094
[x] 17% ImDrawList::AddConcavePolyFilled imgui_draw.lua:7467
-- ImDrawListSplitter
[x] 58% ImDrawListSplitter::ClearFreeMemory imgui_draw.lua:4027
[x] 63% ImDrawListSplitter::Split imgui_draw.lua:4045
[x] 54% ImDrawListSplitter::Merge imgui_draw.lua:4071
[x] 29% ImDrawListSplitter::SetCurrentChannel imgui_draw.lua:4162
[x] 58% ImDrawListSplitter::ClearFreeMemory imgui_draw.lua:4201
[x] 63% ImDrawListSplitter::Split imgui_draw.lua:4219
[x] 54% ImDrawListSplitter::Merge imgui_draw.lua:4245
[x] 29% ImDrawListSplitter::SetCurrentChannel imgui_draw.lua:4336
-- ImDrawData
[x] 60% ImDrawData::Clear imgui_draw.lua:3674
[x] 68% ImGui::AddDrawListToDrawDataEx imgui_draw.lua:3687
[x] 94% ImDrawData::AddDrawList imgui_draw.lua:3709
[x] 60% ImDrawData::Clear imgui_draw.lua:3848
[x] 68% ImGui::AddDrawListToDrawDataEx imgui_draw.lua:3861
[x] 94% ImDrawData::AddDrawList imgui_draw.lua:3883
[ ] ImDrawData::DeIndexAllBuffers
[ ] ImDrawData::ScaleClipRects
@@ -1388,123 +1388,123 @@ imgui_draw.cpp
[x] 20% ImFontConfig::ImFontConfig imgui_h.lua:957
-- ImTextureData
[x] 76% ImTextureDataGetFormatBytesPerPixel imgui_draw.lua:2427
[x] 76% ImTextureDataGetFormatBytesPerPixel imgui_draw.lua:2601
[ ] ImTextureDataGetStatusName
[ ] ImTextureDataGetFormatName
[x] 80% ImTextureData::Create imgui_draw.lua:2437
[x] 71% ImTextureData::DestroyPixels imgui_draw.lua:2422
[x] 80% ImTextureData::Create imgui_draw.lua:2611
[x] 71% ImTextureData::DestroyPixels imgui_draw.lua:2596
-- ImFontAtlas, ImFontAtlasBuilder
[x] 39% ImFontAtlas::ImFontAtlas imgui_h.lua:1038
[-] ImFontAtlas::~ImFontAtlas c++-only
[x] 93% ImFontAtlas::Clear imgui_draw.lua:568
[x] 76% ImFontAtlas::ClearFonts imgui_draw.lua:613
[x] 69% ImFontAtlas::ClearInputData imgui_draw.lua:581
[x] 70% ImFontAtlas::ClearTexData imgui_draw.lua:599
[x] 100% ImFontAtlas::CompactCache imgui_draw.lua:609
[x] 100% ImFontAtlas::SetFontLoader imgui_draw.lua:577
[x] 81% ImFontAtlasBuildUpdateRendererHasTexturesFromContext imgui_draw.lua:1884
[x] 78% ImFontAtlasUpdateNewFrame imgui_draw.lua:687
[x] 93% ImTextureDataUpdateNewFrame imgui_draw.lua:637
[x] 44% ImFontAtlasTextureBlockConvert imgui_draw.lua:778
[x] 100% ImFontAtlasTextureBlockPostProcess imgui_draw.lua:823
[x] 48% ImFontAtlasTextureBlockPostProcessMultiply imgui_draw.lua:832
[x] 93% ImFontAtlas::Clear imgui_draw.lua:571
[x] 76% ImFontAtlas::ClearFonts imgui_draw.lua:616
[x] 69% ImFontAtlas::ClearInputData imgui_draw.lua:584
[x] 70% ImFontAtlas::ClearTexData imgui_draw.lua:602
[x] 100% ImFontAtlas::CompactCache imgui_draw.lua:612
[x] 100% ImFontAtlas::SetFontLoader imgui_draw.lua:580
[x] 81% ImFontAtlasBuildUpdateRendererHasTexturesFromContext imgui_draw.lua:1887
[x] 78% ImFontAtlasUpdateNewFrame imgui_draw.lua:690
[x] 93% ImTextureDataUpdateNewFrame imgui_draw.lua:640
[x] 44% ImFontAtlasTextureBlockConvert imgui_draw.lua:781
[x] 100% ImFontAtlasTextureBlockPostProcess imgui_draw.lua:826
[x] 48% ImFontAtlasTextureBlockPostProcessMultiply imgui_draw.lua:835
[ ] ImFontAtlasTextureBlockFill
[x] 87% ImFontAtlasTextureBlockCopy imgui_draw.lua:874
[x] 100% ImFontAtlasTextureBlockQueueUpload imgui_draw.lua:923
[x] 99% ImTextureDataQueueUpload imgui_draw.lua:894
[x] 87% ImFontAtlasTextureBlockCopy imgui_draw.lua:877
[x] 100% ImFontAtlasTextureBlockQueueUpload imgui_draw.lua:926
[x] 99% ImTextureDataQueueUpload imgui_draw.lua:897
[-] GetTexDataAsFormat obsolete
[-] ImFontAtlas::GetTexDataAsAlpha8 obsolete
[-] ImFontAtlas::GetTexDataAsRGBA32 obsolete
[-] ImFontAtlas::Build obsolete
[x] 83% ImFontAtlas::AddFont imgui_draw.lua:3338
[x] 83% ImFontAtlas::AddFont imgui_draw.lua:3512
[ ] Decode85Byte
[ ] Decode85
[x] 35% GetExpectedContextFontSize imgui_draw.lua:3426
[x] 97% ImFontAtlas::AddFontDefault imgui_draw.lua:3434
[x] 68% ImFontAtlas::AddFontDefaultBitmap imgui_draw.lua:3501
[x] 66% ImFontAtlas::AddFontDefaultVector imgui_draw.lua:3523
[x] 56% ImFontAtlas::AddFontFromFileTTF imgui_draw.lua:3461
[x] 90% ImFontAtlas::AddFontFromMemoryTTF imgui_draw.lua:3442
[~] 0% ImFontAtlas::AddFontFromMemoryCompressedTTF imgui_draw.lua:3457 stub
[x] 35% GetExpectedContextFontSize imgui_draw.lua:3600
[x] 97% ImFontAtlas::AddFontDefault imgui_draw.lua:3608
[x] 68% ImFontAtlas::AddFontDefaultBitmap imgui_draw.lua:3675
[x] 66% ImFontAtlas::AddFontDefaultVector imgui_draw.lua:3697
[x] 56% ImFontAtlas::AddFontFromFileTTF imgui_draw.lua:3635
[x] 90% ImFontAtlas::AddFontFromMemoryTTF imgui_draw.lua:3616
[~] 0% ImFontAtlas::AddFontFromMemoryCompressedTTF imgui_draw.lua:3631 stub
[ ] ImFontAtlas::AddFontFromMemoryCompressedBase85TTF
[x] 92% ImFontAtlasBuildNotifySetFont imgui_draw.lua:2349
[x] 92% ImFontAtlasBuildNotifySetFont imgui_draw.lua:2523
[ ] ImFontAtlas::RemoveFont
[x] 93% ImFontAtlas::AddCustomRect imgui_draw.lua:3590
[x] 93% ImFontAtlas::AddCustomRect imgui_draw.lua:3764
[ ] ImFontAtlas::RemoveCustomRect
[-] ImFontAtlas::AddCustomRectFontGlyph obsolete
[-] ImFontAtlas::AddCustomRectFontGlyphForSize obsolete
[x] 93% ImFontAtlas::GetCustomRect imgui_draw.lua:3542
[x] 78% ImFontAtlasGetMouseCursorTexData imgui_draw.lua:3567
[x] 87% ImFontAtlasBuildMain imgui_draw.lua:2391
[x] 80% ImFontAtlasBuildGetOversampleFactors imgui_draw.lua:948
[x] 91% ImFontAtlasBuildSetupFontLoader imgui_draw.lua:1854
[x] 93% ImFontAtlas::GetCustomRect imgui_draw.lua:3716
[x] 78% ImFontAtlasGetMouseCursorTexData imgui_draw.lua:3741
[x] 87% ImFontAtlasBuildMain imgui_draw.lua:2565
[x] 80% ImFontAtlasBuildGetOversampleFactors imgui_draw.lua:951
[x] 91% ImFontAtlasBuildSetupFontLoader imgui_draw.lua:1857
[ ] ImFontAtlasBuildLegacyPreloadAllGlyphRanges
[~] 0% ImFontAtlasBuildUpdatePointers imgui_draw.lua:1900 stub
[x] 52% ImFontAtlasBuildRenderBitmapFromString imgui_draw.lua:2219
[x] 91% ImFontAtlasBuildUpdateTexDataBasic imgui_draw.lua:2250
[ ] InitCornerGeometry
[ ] SampleConvex
[ ] SampleCornerFillOrStroke
[ ] ImFontAtlasBuildUpdateTexDataCorners
[x] 64% ImFontAtlasBuildUpdateTexDataLines imgui_draw.lua:2079
[x] 89% ImFontAtlasFontInitOutput imgui_draw.lua:1678
[x] 86% ImFontAtlasFontDestroyOutput imgui_draw.lua:1690
[~] 0% ImFontAtlasBuildUpdatePointers imgui_draw.lua:1903 stub
[x] 52% ImFontAtlasBuildRenderBitmapFromString imgui_draw.lua:2392
[x] 91% ImFontAtlasBuildUpdateTexDataBasic imgui_draw.lua:2423
[x] 58% InitCornerGeometry imgui_draw.lua:2088
[x] 78% SampleConvex imgui_draw.lua:2135
[x] 96% SampleCornerFillOrStroke imgui_draw.lua:2146
[x] 73% ImFontAtlasBuildUpdateTexDataCorners imgui_draw.lua:2162
[x] 64% ImFontAtlasBuildUpdateTexDataLines imgui_draw.lua:2252
[x] 89% ImFontAtlasFontInitOutput imgui_draw.lua:1681
[x] 86% ImFontAtlasFontDestroyOutput imgui_draw.lua:1693
[ ] ImFontAtlasFontRebuildOutput
[x] 94% ImFontAtlasFontSourceInit imgui_draw.lua:1703
[x] 95% ImFontAtlasFontSourceAddToFont imgui_draw.lua:1714
[x] 54% ImFontAtlasFontDestroySourceData imgui_draw.lua:1727
[x] 95% ImFontAtlasBuildSetupFontBakedEllipsis imgui_draw.lua:1789
[x] 91% ImFontAtlasBuildSetupFontBakedFallback imgui_draw.lua:1833
[x] 88% ImFontAtlasBuildSetupFontBakedBlanks imgui_draw.lua:1525
[x] 90% ImFontAtlasBuildSetupFontSpecialGlyphs imgui_draw.lua:1745
[x] 94% ImFontAtlasFontSourceInit imgui_draw.lua:1706
[x] 95% ImFontAtlasFontSourceAddToFont imgui_draw.lua:1717
[x] 54% ImFontAtlasFontDestroySourceData imgui_draw.lua:1730
[x] 95% ImFontAtlasBuildSetupFontBakedEllipsis imgui_draw.lua:1792
[x] 91% ImFontAtlasBuildSetupFontBakedFallback imgui_draw.lua:1836
[x] 88% ImFontAtlasBuildSetupFontBakedBlanks imgui_draw.lua:1528
[x] 90% ImFontAtlasBuildSetupFontSpecialGlyphs imgui_draw.lua:1748
[ ] ImFontAtlasBakedDiscardFontGlyph
[x] 81% ImFontAtlasBakedAdd imgui_draw.lua:1548
[x] 89% ImFontAtlasBakedGetClosestMatch imgui_draw.lua:1585
[x] 74% ImFontAtlasBakedDiscard imgui_draw.lua:1627
[x] 83% ImFontAtlasFontDiscardBakes imgui_draw.lua:1656
[x] 83% ImFontAtlasBuildDiscardBakes imgui_draw.lua:965
[x] 92% ImFontAtlasAddDrawListSharedData imgui_draw.lua:988
[x] 92% ImFontAtlasRemoveDrawListSharedData imgui_draw.lua:995
[x] 79% ImFontAtlasUpdateDrawListsTextures imgui_draw.lua:1913
[x] 79% ImFontAtlasUpdateDrawListsSharedData imgui_draw.lua:2281
[x] 98% ImFontAtlasBuildSetTexture imgui_draw.lua:1942
[x] 80% ImFontAtlasBuildUpdateTexData imgui_draw.lua:1952
[x] 91% ImFontAtlasTextureAdd imgui_draw.lua:1959
[x] 81% ImFontAtlasBakedAdd imgui_draw.lua:1551
[x] 89% ImFontAtlasBakedGetClosestMatch imgui_draw.lua:1588
[x] 74% ImFontAtlasBakedDiscard imgui_draw.lua:1630
[x] 83% ImFontAtlasFontDiscardBakes imgui_draw.lua:1659
[x] 83% ImFontAtlasBuildDiscardBakes imgui_draw.lua:968
[x] 92% ImFontAtlasAddDrawListSharedData imgui_draw.lua:991
[x] 92% ImFontAtlasRemoveDrawListSharedData imgui_draw.lua:998
[x] 79% ImFontAtlasUpdateDrawListsTextures imgui_draw.lua:1916
[x] 94% ImFontAtlasUpdateDrawListsSharedData imgui_draw.lua:2454
[x] 98% ImFontAtlasBuildSetTexture imgui_draw.lua:1945
[x] 100% ImFontAtlasBuildUpdateTexData imgui_draw.lua:1955
[x] 91% ImFontAtlasTextureAdd imgui_draw.lua:1962
[-] ImFontAtlasDebugWriteTexToDisk if0
[x] 91% ImFontAtlasTextureRepack imgui_draw.lua:1003
[x] 94% ImFontAtlasTextureGrow imgui_draw.lua:1085
[x] 99% ImFontAtlasTextureMakeSpace imgui_draw.lua:1124
[x] 96% ImFontAtlasTextureGetSizeEstimate imgui_draw.lua:1994
[x] 85% ImFontAtlasBuildClear imgui_draw.lua:2029
[x] 95% ImFontAtlasTextureCompact imgui_draw.lua:2047
[x] 93% ImFontAtlasBuildInit imgui_draw.lua:2291
[x] 91% ImFontAtlasBuildDestroy imgui_draw.lua:2333
[x] 75% ImFontAtlasPackInit imgui_draw.lua:2062
[x] 85% ImFontAtlasPackAllocRectEntry imgui_draw.lua:1141
[x] 93% ImFontAtlasPackReuseRectEntry imgui_draw.lua:1165
[x] 82% ImFontAtlasPackDiscardRect imgui_draw.lua:1175
[x] 91% ImFontAtlasPackAddRect imgui_draw.lua:1203
[x] 75% ImFontAtlasPackGetRect imgui_draw.lua:1254
[x] 82% ImFontAtlasPackGetRectSafe imgui_draw.lua:1269
[x] 66% ImFontAtlasBuildAcceptCodepointForSource imgui_draw.lua:1294
[x] 97% ImFontBaked_BuildGrowIndex imgui_draw.lua:1312
[x] 91% ImFontAtlasTextureRepack imgui_draw.lua:1006
[x] 94% ImFontAtlasTextureGrow imgui_draw.lua:1088
[x] 99% ImFontAtlasTextureMakeSpace imgui_draw.lua:1127
[x] 96% ImFontAtlasTextureGetSizeEstimate imgui_draw.lua:1997
[x] 85% ImFontAtlasBuildClear imgui_draw.lua:2032
[x] 95% ImFontAtlasTextureCompact imgui_draw.lua:2050
[x] 93% ImFontAtlasBuildInit imgui_draw.lua:2465
[x] 91% ImFontAtlasBuildDestroy imgui_draw.lua:2507
[x] 75% ImFontAtlasPackInit imgui_draw.lua:2065
[x] 85% ImFontAtlasPackAllocRectEntry imgui_draw.lua:1144
[x] 93% ImFontAtlasPackReuseRectEntry imgui_draw.lua:1168
[x] 82% ImFontAtlasPackDiscardRect imgui_draw.lua:1178
[x] 91% ImFontAtlasPackAddRect imgui_draw.lua:1206
[x] 75% ImFontAtlasPackGetRect imgui_draw.lua:1257
[x] 82% ImFontAtlasPackGetRectSafe imgui_draw.lua:1272
[x] 66% ImFontAtlasBuildAcceptCodepointForSource imgui_draw.lua:1297
[x] 97% ImFontBaked_BuildGrowIndex imgui_draw.lua:1315
[ ] ImFont::AddRemapCodepoint
[ ] ImFont::AddRemapCodepointToGlyphIndex
[x] 29% ImFontAtlas_FontHookRemapCodepoint imgui_draw.lua:2699
[x] 70% ImFontBaked_BuildLoadGlyph imgui_draw.lua:2714
[x] 77% ImFontBaked_BuildLoadGlyphAdvanceX imgui_draw.lua:2794
[x] 67% BuildLoadGlyphGetAdvanceOrFallback imgui_draw.lua:2839
[x] 29% ImFontAtlas_FontHookRemapCodepoint imgui_draw.lua:2873
[x] 70% ImFontBaked_BuildLoadGlyph imgui_draw.lua:2888
[x] 77% ImFontBaked_BuildLoadGlyphAdvanceX imgui_draw.lua:2968
[x] 67% BuildLoadGlyphGetAdvanceOrFallback imgui_draw.lua:3013
[ ] ImFontAtlasDebugLogTextureRequests
-- ImFontAtlas: backend for stb_truetype
[x] 84% ImGui_ImplStbTrueType_FontSrcInit imgui_draw.lua:1348
[x] 53% ImGui_ImplStbTrueType_FontSrcDestroy imgui_draw.lua:1383
[x] 84% ImGui_ImplStbTrueType_FontSrcInit imgui_draw.lua:1351
[x] 53% ImGui_ImplStbTrueType_FontSrcDestroy imgui_draw.lua:1386
[ ] ImGui_ImplStbTrueType_FontSrcGetGlyphIndexFromCodepoint
[x] 43% ImGui_ImplStbTrueType_FontSrcContainsGlyph imgui_draw.lua:1388
[x] 88% ImGui_ImplStbTrueType_FontBakedInit imgui_draw.lua:1397
[x] 85% ImGui_ImplStbTrueType_FontBakedLoadGlyph imgui_draw.lua:1424
[x] 74% ImFontAtlasGetFontLoaderForStbTruetype imgui_draw.lua:1508
[x] 43% ImGui_ImplStbTrueType_FontSrcContainsGlyph imgui_draw.lua:1391
[x] 88% ImGui_ImplStbTrueType_FontBakedInit imgui_draw.lua:1400
[x] 85% ImGui_ImplStbTrueType_FontBakedLoadGlyph imgui_draw.lua:1427
[x] 74% ImFontAtlasGetFontLoaderForStbTruetype imgui_draw.lua:1511
-- ImFontAtlas: glyph ranges helpers
[ ] ImFontAtlas::GetGlyphRangesDefault
@@ -1525,45 +1525,45 @@ imgui_draw.cpp
-- ImFontBaked, ImFont
[x] 12% ImFontBaked::ImFontBaked imgui_h.lua:844
[x] 79% ImFontBaked::ClearOutputData imgui_draw.lua:2462
[x] 79% ImFontBaked::ClearOutputData imgui_draw.lua:2636
[x] 10% ImFont::ImFont imgui_h.lua:901
[-] ImFont::~ImFont c++-only
[x] 49% ImFont::ClearOutputData imgui_draw.lua:2516
[x] 49% ImFont::ClearOutputData imgui_draw.lua:2690
[ ] ImFont::IsGlyphRangeUnused
[x] 87% ImFontAtlasBakedAddFontGlyph imgui_draw.lua:2582
[x] 87% ImFontAtlasBakedAddFontGlyphAdvancedX imgui_draw.lua:2640
[x] 84% ImFontAtlasBakedSetFontGlyphBitmap imgui_draw.lua:937
[x] 85% ImFontBaked::FindGlyph imgui_draw.lua:2476
[x] 88% ImFontBaked::FindGlyphNoFallback imgui_draw.lua:2499
[x] 49% ImFontBaked::IsGlyphLoaded imgui_draw.lua:2491
[x] 50% ImFont::IsGlyphInFont imgui_draw.lua:2811
[x] 86% ImFontBaked::GetCharAdvance imgui_draw.lua:2827
[x] 46% ImFontAtlasBakedGetId imgui_draw.lua:2531
[x] 90% ImFont::GetFontBaked imgui_draw.lua:2665
[x] 91% ImFontAtlasBakedGetOrAdd imgui_draw.lua:2541
[x] 55% ImTextCalcWordWrapNextLineStart imgui_draw.lua:2849
[x] 81% ImTextClassifierClear imgui_draw.lua:2869
[x] 53% ImTextClassifierSetCharClass imgui_draw.lua:2880
[x] 60% ImTextClassifierSetCharClassFromStr imgui_draw.lua:2888
[x] 88% ImTextInitClassifiers imgui_draw.lua:2906
[x] 35% ImFontCalcWordWrapPositionEx imgui_draw.lua:2937
[x] 87% ImFontAtlasBakedAddFontGlyph imgui_draw.lua:2756
[x] 87% ImFontAtlasBakedAddFontGlyphAdvancedX imgui_draw.lua:2814
[x] 84% ImFontAtlasBakedSetFontGlyphBitmap imgui_draw.lua:940
[x] 85% ImFontBaked::FindGlyph imgui_draw.lua:2650
[x] 88% ImFontBaked::FindGlyphNoFallback imgui_draw.lua:2673
[x] 49% ImFontBaked::IsGlyphLoaded imgui_draw.lua:2665
[x] 50% ImFont::IsGlyphInFont imgui_draw.lua:2985
[x] 86% ImFontBaked::GetCharAdvance imgui_draw.lua:3001
[x] 46% ImFontAtlasBakedGetId imgui_draw.lua:2705
[x] 90% ImFont::GetFontBaked imgui_draw.lua:2839
[x] 91% ImFontAtlasBakedGetOrAdd imgui_draw.lua:2715
[x] 55% ImTextCalcWordWrapNextLineStart imgui_draw.lua:3023
[x] 81% ImTextClassifierClear imgui_draw.lua:3043
[x] 53% ImTextClassifierSetCharClass imgui_draw.lua:3054
[x] 60% ImTextClassifierSetCharClassFromStr imgui_draw.lua:3062
[x] 88% ImTextInitClassifiers imgui_draw.lua:3080
[x] 35% ImFontCalcWordWrapPositionEx imgui_draw.lua:3111
[ ] ImFont::CalcWordWrapPosition
[x] 49% ImFontCalcTextSizeEx imgui_draw.lua:3111
[x] 91% ImFont::CalcTextSizeA imgui_draw.lua:3272
[x] 85% ImFont::RenderChar imgui_draw.lua:3285
[x] 66% ImFont::RenderText imgui_draw.lua:6480
[x] 49% ImFontCalcTextSizeEx imgui_draw.lua:3285
[x] 91% ImFont::CalcTextSizeA imgui_draw.lua:3446
[x] 85% ImFont::RenderChar imgui_draw.lua:3459
[x] 66% ImFont::RenderText imgui_draw.lua:6853
-- ImGui Internal Render Helpers
[x] 58% ImGui::RenderArrow imgui_draw.lua:6727
[x] 88% ImGui::RenderBullet imgui_draw.lua:6759
[x] 63% ImGui::RenderCheckMark imgui_draw.lua:6771
[x] 90% ImGui::RenderArrowPointingAt imgui_draw.lua:6796
[x] 58% ImGui::RenderArrow imgui_draw.lua:7100
[x] 88% ImGui::RenderBullet imgui_draw.lua:7132
[x] 63% ImGui::RenderCheckMark imgui_draw.lua:7144
[x] 90% ImGui::RenderArrowPointingAt imgui_draw.lua:7169
[x] 93% ImGui::RenderArrowDockMenu imgui.lua:4551
[x] 100% ImAcos01 imgui_draw.lua:6809
[x] 95% ImGui::RenderRectFilledInRangeH imgui_draw.lua:6825
[x] 80% ImGui::RenderRectFilledWithHole imgui_draw.lua:6989
[x] 81% ImGui::CalcRoundingFlagsForRectInRect imgui_draw.lua:6880
[x] 70% ImGui::RenderColorRectWithAlphaCheckerboard imgui_draw.lua:6916
[x] 100% ImAcos01 imgui_draw.lua:7182
[x] 95% ImGui::RenderRectFilledInRangeH imgui_draw.lua:7198
[x] 80% ImGui::RenderRectFilledWithHole imgui_draw.lua:7362
[x] 81% ImGui::CalcRoundingFlagsForRectInRect imgui_draw.lua:7253
[x] 70% ImGui::RenderColorRectWithAlphaCheckerboard imgui_draw.lua:7289
-- Decompression code
[ ] stb_decompress_length
@@ -1961,7 +1961,7 @@ imgui.h
[x] 14% ImDrawCmd::ImDrawCmd imgui_h.lua:507
[x] 18% ImDrawListSplitter::ImDrawListSplitter imgui_h.lua:594
[-] ImDrawListSplitter::~ImDrawListSplitter c++-only
[x] 92% ImDrawListSplitter::Clear imgui_draw.lua:4022
[x] 92% ImDrawListSplitter::Clear imgui_draw.lua:4196
[ ] ImDrawList::GetClipRectMin
[ ] ImDrawList::GetClipRectMax
[x] 80% ImDrawList::AddPolyline imgui_internal.lua:1077
@@ -1969,11 +1969,11 @@ imgui.h
[x] 16% ImDrawList::PathLineTo imgui_internal.lua:1033
[x] 48% ImDrawList::PathLineToMergeDuplicate imgui_internal.lua:1043
[x] 94% ImDrawList::PathFillConvex imgui_internal.lua:1053
[x] 94% ImDrawList::PathFillConcave imgui_draw.lua:7135
[x] 94% ImDrawList::PathFillConcave imgui_draw.lua:7508
[x] 75% ImDrawList::PathStroke imgui_internal.lua:1061
[x] 89% ImDrawList::ChannelsSplit imgui_draw.lua:4203
[x] 80% ImDrawList::ChannelsMerge imgui_draw.lua:4204
[x] 89% ImDrawList::ChannelsSetCurrent imgui_draw.lua:4206
[x] 89% ImDrawList::ChannelsSplit imgui_draw.lua:4377
[x] 80% ImDrawList::ChannelsMerge imgui_draw.lua:4378
[x] 89% ImDrawList::ChannelsSetCurrent imgui_draw.lua:4380
[x] 16% ImDrawList::PrimWriteVtx imgui_h.lua:631
[x] 44% ImDrawList::PrimWriteIdx imgui_h.lua:641
[x] 89% ImDrawList::PrimVtx imgui_h.lua:649
+380 -7
View File
@@ -446,7 +446,10 @@ local ImFontAtlasBakedGetClosestMatch
local ImFontAtlasBuildInit
local ImFontAtlasBuildSetTexture
local ImFontAtlasBuildUpdateTexDataLines
local ImFontAtlasBuildUpdateTexDataCorners
local ImFontAtlasBuildUpdateTexDataBasic
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC -- [Luau] forward declared, defined in [SECTION] ImDrawList
local CalcCornerArcStepAndCount -- [Luau] forward declared, defined in [SECTION] ImDrawList
local ImFontAtlasBuildSetupFontLoader
local ImFontAtlasBuildSetupFontSpecialGlyphs
local ImFontAtlasBuildSetupFontBakedBlanks
@@ -1952,7 +1955,7 @@ end
function ImFontAtlasBuildUpdateTexData(atlas)
ImFontAtlasBuildUpdateTexDataBasic(atlas)
ImFontAtlasBuildUpdateTexDataLines(atlas)
-- [Port] TODO baked round corners: ImFontAtlasBuildUpdateTexDataCorners(atlas)
ImFontAtlasBuildUpdateTexDataCorners(atlas)
end
-- Create a new texture, discard previous one
@@ -2076,6 +2079,176 @@ function ImFontAtlasPackInit(atlas)
end
--- @param atlas ImFontAtlas
-- #define IM_DRAWLIST_CORNER_POINTS_MAX (IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4 + 3) // Max number of points in corner profiles
-- [Luau] ImVec2 line_normals[] / float line_distances[] / ImVec2 points[] are flat 1-based scratch arrays (x, y, distance).
local corner_points_x, corner_points_y = {}, {}
local corner_normals_x, corner_normals_y, corner_distances = {}, {}, {}
-- [Luau] line_normals is passed as two arrays (line_normals_x, line_normals_y), 1-based.
local function InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- This tries to quite faithfully replicate how we render the corners using tessellation.
-- Older code sampled a circle SDF directly, but it had clearly visible discrepancy between the baked corners
-- and tessellated corners due to circle_segment_max_error.
local auto_seg_count = IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(rounding, circle_segment_max_error)
local arc_step, arc_step_count = CalcCornerArcStepAndCount(auto_seg_count)
local arc_point_count = arc_step_count + 1
-- Build arc of points, with straight segments at each end.
-- . [n-2]..[n-1]
-- .`
-- .
-- [1] x (cx,cy)
-- :
-- [0]
local points_x, points_y = corner_points_x, corner_points_y
local num_points = 0
num_points = num_points + 1; points_x[num_points] = cx - rounding; points_y[num_points] = cy + 1.0
local da = (arc_step / IM_DRAWLIST_ARCFAST_TABLE_SIZE) * IM_PI * 2.0
local a = IM_PI
for _ = 0, arc_point_count - 1 do
local dx = ImCos(a)
local dy = ImSin(a)
num_points = num_points + 1; points_x[num_points] = cx + dx * rounding; points_y[num_points] = cy + dy * rounding
a = a + da
end
num_points = num_points + 1; points_x[num_points] = cx + 1.0; points_y[num_points] = cy - rounding
-- Turn segments to half spaces.
for i = 1, num_points - 1 do
local diff_x = points_x[i + 1] - points_x[i]
local diff_y = points_y[i + 1] - points_y[i]
local d2 = diff_x * diff_x + diff_y * diff_y
local inv_d = ImRsqrtPrecise(d2)
line_normals_x[i] = diff_y * inv_d -- Normal points outwards
line_normals_y[i] = -diff_x * inv_d
line_distances[i] = -(points_x[i] * line_normals_x[i] + points_y[i] * line_normals_y[i]) -- -ImDot()
end
return num_points - 1
end
-- Returns distance to convex shape limited by lines.
local function SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local result = -FLT_MAX
for i = 1, num_lines do
local d = line_normals_x[i] * x + line_normals_y[i] * y + line_distances[i]
if d > result then
result = d
end
end
return result
end
local function SampleCornerFillOrStroke(x, y, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
local d = SampleConvex(x, y, line_normals_x, line_normals_y, line_distances, num_lines)
local aa_width = 1.0
if thickness == 0.0 then
-- Fill
return math.floor(ImClamp(1.0 - (d + aa_width * 0.5) / aa_width, 0.0, 1.0) * 255.0) -- (ImU8)
else
-- Stroke
local outer = 1.0 - (d + aa_width * 0.5) / aa_width
local inner = (d + thickness + aa_width * 0.5) / aa_width
return math.floor(ImClamp(ImMin(inner, outer), 0.0, 1.0) * 255.0) -- (ImU8)
end
end
-- [Port] #if 0 DEBUG_TEX_CORNER_U8/DEBUG_TEX_CORNER_U32 coverage visualization not ported (always 0xFF/0xFFFFFFFF).
function ImFontAtlasBuildUpdateTexDataCorners(atlas)
if bit32.band(atlas.Flags, ImFontAtlasFlags.NoBakedRoundCorners) ~= 0 then
return
end
-- Pack and store identifier so we can refresh UV coordinates on texture resize.
local tex = atlas.TexData
local builder = atlas.Builder
-- FIXME-TEXCORNERS: Ideally we should pick up the max error from the styles, but it does not seem be to set by the time we build the data the first time.
local circle_segment_max_error = 0.30 -- Default matching ImGuiStyle::CircleTessellationMaxError.
-- if (atlas->OwnerContext)
-- circle_segment_max_error = atlas->OwnerContext->DrawListSharedData.CircleSegmentMaxError;
-- Calculate size and pack
local r = ImFontAtlasRect()
local add_and_draw = (atlas:GetCustomRect(builder.PackIdCornersTexData, r) == false)
if add_and_draw then
-- (thickness 0 for filled, thickness >0 for strokes)
local pack_size_x, pack_size_y = 0, 0 -- ImVec2i
for thickness = 0, IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX - 1 do
local is_filled = (thickness == 0)
local row_width = 0
local row_height = 0
for n = 0, IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX - 1 do
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
row_width = row_width + size + 2
row_height = ImMax(row_height, size + 2)
end
pack_size_x = ImMax(pack_size_x, row_width)
pack_size_y = pack_size_y + row_height
end
builder.PackIdCornersTexData = atlas:AddCustomRect(pack_size_x, pack_size_y, r)
IM_ASSERT(builder.PackIdCornersTexData ~= ImFontAtlasRectId_Invalid)
end
-- Render
local y = r.y
local line_normals_x, line_normals_y, line_distances = corner_normals_x, corner_normals_y, corner_distances
for thickness = 0, IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX - 1 do
local is_filled = (thickness == 0)
local x = r.x
local row_height = 0
for n = 0, IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX - 1 do
-- Filled: Always add 1px to the fill side of the rounded corner to prevent the corner AA to bleed into the rectangle edges.
local rounding = n + 1
local size = is_filled and (rounding + 1) or ImMax(rounding, thickness)
local w = size + 2
local h = size + 2
-- Corner circle
local cx = 1.0 + (n + 1)
local cy = 1.0 + (n + 1)
IM_ASSERT((x + w) <= (r.x + r.w) and (y + h) <= (r.y + r.h)) -- Make sure we're inside the texture bounds
local num_lines = InitCornerGeometry(cx, cy, rounding, circle_segment_max_error, line_normals_x, line_normals_y, line_distances)
-- Write each slice
if add_and_draw and tex.Format == ImTextureFormat.Alpha8 then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_ptr[write_ptr_base + lx] = SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)
end
write_ptr_base = write_ptr_base + pitch
end
elseif add_and_draw and tex.Format == ImTextureFormat.RGBA32 then
local write_ptr, write_ptr_base = tex:GetPixelsAt(x, y)
local pitch = tex.Width * 4
for ly = 0, h - 1 do
for lx = 0, w - 1 do
write_u32(write_ptr, write_ptr_base + lx * 4, IM_COL32(255, 255, 255, SampleCornerFillOrStroke(lx + 0.5, ly + 0.5, thickness, line_normals_x, line_normals_y, line_distances, num_lines)))
end
write_ptr_base = write_ptr_base + pitch
end
end
-- Refresh UV coordinates
local uv0_x, uv0_y = (x + 1) * atlas.TexUvScale.x, (y + 1) * atlas.TexUvScale.y
local uv1_x, uv1_y = (x + 1 + size) * atlas.TexUvScale.x, (y + 1 + size) * atlas.TexUvScale.y
builder.TexUvCorners[n + thickness * IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX] = ImVec4(uv0_x, uv0_y, uv1_x, uv1_y)
x = x + w
row_height = ImMax(row_height, h)
end
y = y + row_height
end
end
function ImFontAtlasBuildUpdateTexDataLines(atlas)
if bit32.band(atlas.Flags, ImFontAtlasFlags.NoBakedLines) ~= 0 then
return
@@ -2283,6 +2456,7 @@ function ImFontAtlasUpdateDrawListsSharedData(atlas)
if (shared_data.FontAtlas == atlas) then
shared_data.TexUvWhitePixel = atlas.TexUvWhitePixel
shared_data.TexUvLines = atlas.Builder.TexUvLines
shared_data.TexUvCorners = atlas.Builder.TexUvCorners
end
end
end
@@ -3714,13 +3888,13 @@ end
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN = 4
local IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX = 512
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(IM_PI / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC(_RAD, _MAXERROR) return ImClamp(IM_ROUNDUP_TO_EVEN(ImCeil(IM_PI / ImAcos(1 - ImMin(_MAXERROR, _RAD) / _RAD))), IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MIN, IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_MAX) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_R(_N, _MAXERROR) return (_MAXERROR / (1 - ImCos(IM_PI / ImMax(_N, IM_PI)))) end
local function IM_DRAWLIST_CIRCLE_AUTO_SEGMENT_CALC_ERROR(_N, _RAD) return ((1 - ImCos(IM_PI / ImMax(_N, IM_PI))) / _RAD) end
-- Calculates arc step and step count for 90 degree arc. The calculated arc step will complete a 90 degree arc when stepped arc_step_count times.
-- [Luau] returns arc_step, arc_step_count (C++ out-references)
local function CalcCornerArcStepAndCount(segment_count)
function CalcCornerArcStepAndCount(segment_count)
local quarter = IM_DRAWLIST_ARCFAST_TABLE_SIZE / 4
local arc_step = ImClamp(math.floor(IM_DRAWLIST_ARCFAST_SAMPLE_MAX / segment_count), 1, quarter)
local arc_step_count = math.floor(quarter / arc_step)
@@ -5329,7 +5503,122 @@ function MT.ImDrawList:AddLineV(x, min_y, max_y, col, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectBaked() (UseTexForRoundCorners) not ported yet, AddRect() falls back to the geometry path.
-- [Luau] IM_APPEND_VTX() x4 + IM_APPEND_TRI(idx + 0, idx + 1, idx + 2) + IM_APPEND_TRI(idx + 0, idx + 2, idx + 3)
local function AppendQuadUV(self, x0, y0, u0, v0, x1, y1, u1, v1, x2, y2, u2, v2, x3, y3, u3, v3, col)
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, x0, y0, u0, v0, col)
WV(vb, vw + 1, x1, y1, u1, v1, col)
WV(vb, vw + 2, x2, y2, u2, v2, col)
WV(vb, vw + 3, x3, y3, u3, v3, col)
ib[iw + 0] = idx + 0; ib[iw + 1] = idx + 1; ib[iw + 2] = idx + 2
ib[iw + 3] = idx + 0; ib[iw + 4] = idx + 2; ib[iw + 5] = idx + 3
self._VtxWritePtr = vw + 4
self._IdxWritePtr = iw + 6
self._VtxCurrentIdx = idx + 4
end
-- [Luau] _AddRectBaked() taking p_min/p_max as scalars
@native
local function _AddRectBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, t, tex_uvs, flags)
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
local idx_allocated = 8 * 2 * 3
local vtx_allocated = 8 * 4
PrimReserve(self, idx_allocated, vtx_allocated)
local start_vtx_ptr = self._VtxWritePtr
local start_idx_ptr = self._IdxWritePtr
local round_tl = bit32.band(flags, ImDrawFlags.RoundTopLeft) ~= 0
local round_tr = bit32.band(flags, ImDrawFlags.RoundTopRight) ~= 0
local round_br = bit32.band(flags, ImDrawFlags.RoundBottomRight) ~= 0
local round_bl = bit32.band(flags, ImDrawFlags.RoundBottomLeft) ~= 0
if round_tl then
AppendQuadUV(self,
p_min_x, p_min_y, uv_l, uv_t,
p_min_x + r, p_min_y, uv_r, uv_t,
p_min_x + r, p_min_y + r, uv_r, uv_b,
p_min_x, p_min_y + r, uv_l, uv_b, col)
end
if round_tr then
AppendQuadUV(self,
p_max_x - r, p_min_y, uv_r, uv_t,
p_max_x, p_min_y, uv_l, uv_t,
p_max_x, p_min_y + r, uv_l, uv_b,
p_max_x - r, p_min_y + r, uv_r, uv_b, col)
end
if round_br then
AppendQuadUV(self,
p_max_x - r, p_max_y - r, uv_r, uv_b,
p_max_x, p_max_y - r, uv_l, uv_b,
p_max_x, p_max_y, uv_l, uv_t,
p_max_x - r, p_max_y, uv_r, uv_t, col)
end
if round_bl then
AppendQuadUV(self,
p_min_x, p_max_y - r, uv_l, uv_b,
p_min_x + r, p_max_y - r, uv_r, uv_b,
p_min_x + r, p_max_y, uv_r, uv_t,
p_min_x, p_max_y, uv_l, uv_t, col)
end
local r_tl = round_tl and r or 0
local r_tr = round_tr and r or 0
local r_br = round_br and r or 0
local r_bl = round_bl and r or 0
local opaque_uv = self._Data.TexUvWhitePixel
local ou, ov = opaque_uv.x, opaque_uv.y
do
-- Top
local x0 = p_min_x + r_tl
local x1 = p_max_x - r_tr
AppendQuadUV(self, x0, p_min_y, ou, ov, x1, p_min_y, ou, ov, x1, p_min_y + t, ou, ov, x0, p_min_y + t, ou, ov, col)
end
do
-- Left
local y0 = p_min_y + ImMax(r_tl, t)
local y1 = p_max_y - ImMax(r_bl, t)
AppendQuadUV(self, p_min_x, y0, ou, ov, p_min_x + t, y0, ou, ov, p_min_x + t, y1, ou, ov, p_min_x, y1, ou, ov, col)
end
do
-- Right
local y0 = p_min_y + ImMax(r_tr, t)
local y1 = p_max_y - ImMax(r_br, t)
AppendQuadUV(self, p_max_x - t, y0, ou, ov, p_max_x, y0, ou, ov, p_max_x, y1, ou, ov, p_max_x - t, y1, ou, ov, col)
end
do
-- Bottom
local x0 = p_min_x + r_bl
local x1 = p_max_x - r_br
AppendQuadUV(self, x0, p_max_y - t, ou, ov, x1, p_max_y - t, ou, ov, x1, p_max_y, ou, ov, x0, p_max_y, ou, ov, col)
end
local idx_used = self._IdxWritePtr - start_idx_ptr
local vtx_used = self._VtxWritePtr - start_vtx_ptr
IM_ASSERT_PARANOID(idx_used <= idx_allocated and vtx_used <= vtx_allocated)
if idx_used < idx_allocated or vtx_used < vtx_allocated then
self:PrimUnreserve(idx_allocated - idx_used, vtx_allocated - vtx_used)
end
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param t float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectBaked(p_min, p_max, col, r, t, tex_uvs, flags)
_AddRectBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, t, tex_uvs, flags)
end
local corner_offset_x = { 1, -1, -1, 1 } -- static const ImVec2 corner_offset[4] = { {1,1}, {-1,1}, {-1,-1}, {1,-1} };
local corner_offset_y = { 1, 1, -1, -1 }
@@ -5585,7 +5874,18 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(ImDrawFlags.AALines, ImDrawFlags.UseTexForRoundCorners, ImDrawFlags.AllowTexForRoundCorners_)
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_thickness < IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX and s_rounding <= IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX then
-- Pixel aligned rect with round corners rendered using baked textures.
IM_ASSERT_PARANOID(s_thickness > 0 and s_rounding > 0)
local size = ImMax(s_rounding, s_thickness) -- This is matching the baking calculations.
local idx = (s_thickness * IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX) + s_rounding - 1
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
IM_ASSERT_PARANOID(idx >= 0 and idx < IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX * IM_DRAWLIST_TEX_CORNERS_THICKNESS_MAX)
_AddRectBakedXY(self, outer_min_x, outer_min_y, outer_max_x, outer_max_y, col, size * fringe_scale, thickness, self._Data.TexUvCorners[idx], flags)
return
end
end
if not has_rounding or bit32.band(flags, ImDrawFlags.RoundMask_) == ImDrawFlags.RoundNone then
@@ -5619,7 +5919,67 @@ function MT.ImDrawList:AddRect(p_min, p_max, col, rounding, thickness, flags)
end
end
-- [Port] TODO baked round corners: _AddRectFilledBaked() (UseTexForRoundCorners) not ported yet, AddRectFilled() falls back to the geometry path.
-- [Luau] _AddRectFilledBaked() taking p_min/p_max as scalars
@native
local function _AddRectFilledBakedXY(self, p_min_x, p_min_y, p_max_x, p_max_y, col, r, tex_uvs, flags)
-- 9-slice with corner mirroring
local uv_l, uv_t, uv_r, uv_b = tex_uvs.x, tex_uvs.y, tex_uvs.z, tex_uvs.w -- uv_tl = (l,t), uv_tr = (r,t), uv_br = (r,b), uv_bl = (l,b)
PrimReserve(self, 9 * 2 * 3, 4 * 4)
local r_tl = (bit32.band(flags, ImDrawFlags.RoundTopLeft) ~= 0) and r or 0.0
local r_tr = (bit32.band(flags, ImDrawFlags.RoundTopRight) ~= 0) and r or 0.0
local r_br = (bit32.band(flags, ImDrawFlags.RoundBottomRight) ~= 0) and r or 0.0
local r_bl = (bit32.band(flags, ImDrawFlags.RoundBottomLeft) ~= 0) and r or 0.0
local vb = self.VtxBuffer.Buf
local ib = self.IdxBuffer.Data
local vw = self._VtxWritePtr
local iw = self._IdxWritePtr
local idx = self._VtxCurrentIdx
WV(vb, vw + 0, p_min_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 1, p_min_x + r_tl, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 2, p_max_x - r_tr, p_min_y, uv_r, uv_t, col)
WV(vb, vw + 3, p_max_x, p_min_y, uv_l, uv_t, col)
WV(vb, vw + 4, p_min_x, p_min_y + r_tl, uv_l, uv_b, col)
WV(vb, vw + 5, p_min_x + r_tl, p_min_y + r_tl, uv_r, uv_b, col)
WV(vb, vw + 6, p_max_x - r_tr, p_min_y + r_tr, uv_r, uv_b, col)
WV(vb, vw + 7, p_max_x, p_min_y + r_tr, uv_l, uv_b, col)
WV(vb, vw + 8, p_min_x, p_max_y - r_bl, uv_l, uv_b, col)
WV(vb, vw + 9, p_min_x + r_bl, p_max_y - r_bl, uv_r, uv_b, col)
WV(vb, vw + 10, p_max_x - r_br, p_max_y - r_br, uv_r, uv_b, col)
WV(vb, vw + 11, p_max_x, p_max_y - r_br, uv_l, uv_b, col)
WV(vb, vw + 12, p_min_x, p_max_y, uv_l, uv_t, col)
WV(vb, vw + 13, p_min_x + r_bl, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 14, p_max_x - r_br, p_max_y, uv_r, uv_t, col)
WV(vb, vw + 15, p_max_x, p_max_y, uv_l, uv_t, col)
for _ = 0, 2 do
for _ = 0, 2 do
ib[iw + 0] = idx + 4; ib[iw + 1] = idx + 0; ib[iw + 2] = idx + 1
ib[iw + 3] = idx + 4; ib[iw + 4] = idx + 1; ib[iw + 5] = idx + 5
iw = iw + 6
idx = idx + 1
end
idx = idx + 1
end
self._VtxWritePtr = vw + 16
self._IdxWritePtr = iw
self._VtxCurrentIdx = self._VtxCurrentIdx + 16
end
--- @param p_min ImVec2
--- @param p_max ImVec2
--- @param col ImU32
--- @param r float
--- @param tex_uvs ImVec4
--- @param flags ImDrawFlags
function MT.ImDrawList:_AddRectFilledBaked(p_min, p_max, col, r, tex_uvs, flags)
_AddRectFilledBakedXY(self, p_min.x, p_min.y, p_max.x, p_max.y, col, r, tex_uvs, flags)
end
--- @param p_min ImVec2
--- @param p_max ImVec2
@@ -5696,7 +6056,20 @@ function MT.ImDrawList:AddRectFilled(p_min, p_max, col, rounding, flags)
return
end
-- Textured corners are baked with AA, do not use them if no-AA is requested.
-- [Port] TODO baked round corners: allow_tex_corners -> _AddRectFilledBaked(), falls back to the geometry path below.
local allow_tex_corners_mask = bit32.bor(ImDrawFlags.AAFill, ImDrawFlags.UseTexForRoundCorners, ImDrawFlags.AllowTexForRoundCorners_)
local allow_tex_corners = bit32.band(flags, allow_tex_corners_mask) == allow_tex_corners_mask
if allow_tex_corners and s_rounding <= IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX then
-- IM_ASSERT_PARANOID((_Data->Font->OwnerAtlas->Flags & ImFontAtlasFlags_NoBakedRoundCorners) == 0) -- [Luau] not evaluated (arguments are not compiled out)
-- This is matching the baking calculations. The rounding clamping above makes sure that there's enough space for the extra pixel.
local corner_size = s_rounding + 1
-- Check that the baked corners do not overlap (this could be made more accurate if tested for x and y separately).
if corner_size * 2.0 * fringe_scale < min_dim then
local idx = (s_rounding - 1)
IM_ASSERT_PARANOID(idx >= 0 and idx < IM_DRAWLIST_TEX_CORNERS_ROUNDING_MAX)
_AddRectFilledBakedXY(self, ax, ay, bx, by, col, corner_size * fringe_scale, self._Data.TexUvCorners[idx], flags)
return
end
end
end
if not has_rounding then
+1 -1
View File
@@ -4,4 +4,4 @@ set -e
cd "$(dirname "$0")/../../.."
python3 tools/bundle.py --target love >/dev/null
nix-shell -p luajit --run "luajit tools/test/love/t_drawhash.lua 150 Widgets,Basic && luajit tools/test/love/t_drawhash.lua 150 all && luajit tools/test/love/t_examples.lua"
echo "expected (Luau, tools/test/scripts/t_drawhash.luau): 2057580240 / 2004376225"
echo "expected (Luau, tools/test/scripts/t_drawhash.luau): 1746012297 / 1639427837"