MCPcopy Create free account
hub / github.com/cinder/Cinder / TableBeginInitMemory

Method TableBeginInitMemory

src/imgui/imgui_tables.cpp:655–674  ·  view source on GitHub ↗

For reference, the average total _allocation count_ for a table is: + 0 (for ImGuiTable instance, we are pooling allocations in g.Tables[]) + 1 (for table->RawData allocated below) + 1 (for table->ColumnsNames, if names are used) Shared allocations for the maximum number of simultaneously nested tables (generally a very small number) + 1 (for table->Splitter._Channels) + 2 * active_channels_count

Source from the content-addressed store, hash-verified

653// Where active_channels_count is variable but often == columns_count or == columns_count + 1, see TableSetupDrawChannels() for details.
654// Unused channels don't perform their +2 allocations.
655void ImGui::TableBeginInitMemory(ImGuiTable* table, int columns_count)
656{
657 // Allocate single buffer for our arrays
658 const int columns_bit_array_size = (int)ImBitArrayGetStorageSizeInBytes(columns_count);
659 ImSpanAllocator<6> span_allocator;
660 span_allocator.Reserve(0, columns_count * sizeof(ImGuiTableColumn));
661 span_allocator.Reserve(1, columns_count * sizeof(ImGuiTableColumnIdx));
662 span_allocator.Reserve(2, columns_count * sizeof(ImGuiTableCellData), 4);
663 for (int n = 3; n < 6; n++)
664 span_allocator.Reserve(n, columns_bit_array_size);
665 table->RawData = IM_ALLOC(span_allocator.GetArenaSizeInBytes());
666 memset(table->RawData, 0, span_allocator.GetArenaSizeInBytes());
667 span_allocator.SetArenaBasePtr(table->RawData);
668 span_allocator.GetSpan(0, &table->Columns);
669 span_allocator.GetSpan(1, &table->DisplayOrderToIndex);
670 span_allocator.GetSpan(2, &table->RowCellData);
671 table->EnabledMaskByDisplayOrder = (ImU32*)span_allocator.GetSpanPtrBegin(3);
672 table->EnabledMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(4);
673 table->VisibleMaskByIndex = (ImU32*)span_allocator.GetSpanPtrBegin(5);
674}
675
676// Apply queued resizing/reordering/hiding requests
677void ImGui::TableBeginApplyRequests(ImGuiTable* table)

Callers

nothing calls this directly

Calls 6

GetArenaSizeInBytesMethod · 0.80
SetArenaBasePtrMethod · 0.80
GetSpanMethod · 0.80
GetSpanPtrBeginMethod · 0.80
ReserveMethod · 0.45

Tested by

no test coverage detected