forked from Green-Sky/tomato
improve file selector performance (20% in my extreme case)
This commit is contained in:
parent
08c9ba3983
commit
73afcfaaeb
@ -199,7 +199,11 @@ void FileSelector::render(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// files
|
// files
|
||||||
for (auto const& dir_entry : files) {
|
ImGuiListClipper files_clipper;
|
||||||
|
files_clipper.Begin(files.size());
|
||||||
|
while (files_clipper.Step()) {
|
||||||
|
for (int row = files_clipper.DisplayStart; row < files_clipper.DisplayEnd; row++) {
|
||||||
|
const auto& dir_entry = files.at(row);
|
||||||
if (ImGui::TableNextColumn()) {
|
if (ImGui::TableNextColumn()) {
|
||||||
ImGui::PushID(tmp_id++);
|
ImGui::PushID(tmp_id++);
|
||||||
if (ImGui::Selectable("F", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
|
if (ImGui::Selectable("F", false, ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowItemOverlap)) {
|
||||||
@ -228,6 +232,7 @@ void FileSelector::render(void) {
|
|||||||
ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min);
|
ImGui::TextDisabled("%2d.%2d.%2d - %2d:%2d", ltime->tm_mday, ltime->tm_mon, ltime->tm_year + 1900, ltime->tm_hour, ltime->tm_min);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user