mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-04 03:58:47 +02:00
Tables: Fixed unaligned accesses when using TableSetBgColor(ImGuiTableBgTarget_CellBg). (#3872)
ImSpanAllocator: Support for alignment.
This commit is contained in:
@ -538,9 +538,9 @@ void ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count)
|
||||
{
|
||||
// Allocate single buffer for our arrays
|
||||
ImSpanAllocator<3> span_allocator;
|
||||
span_allocator.ReserveBytes(0, columns_count * sizeof(ImGuiTableColumn));
|
||||
span_allocator.ReserveBytes(1, columns_count * sizeof(ImGuiTableColumnIdx));
|
||||
span_allocator.ReserveBytes(2, columns_count * sizeof(ImGuiTableCellData));
|
||||
span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn));
|
||||
span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx));
|
||||
span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4);
|
||||
table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes());
|
||||
memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes());
|
||||
span_allocator.SetArenaBasePtr(table->RawData);
|
||||
|
Reference in New Issue
Block a user