Add a small optimization

This commit is contained in:
blankie 2023-01-29 18:59:33 +07:00
parent 3f696c0076
commit 072466c54f
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 10 additions and 11 deletions

View File

@ -28,8 +28,8 @@ static inline void render_table(ImFont* monospace_font, bool* autoscrolling) {
strftime(time_as_str, 127 * sizeof(char), "%c", localtime(&log_entry->time));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TextUnformatted(time_as_str);
ImGui::TableSetColumnIndex(1); ImGui::TextUnformatted(log_entry->message);
if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted(time_as_str);
if (ImGui::TableSetColumnIndex(1)) ImGui::TextUnformatted(log_entry->message);
}
}
clipper.End();

View File

@ -32,17 +32,16 @@ static inline void render_table(ImFont* monospace_font, std::vector<LogcatEntry>
strftime(time_as_str, 127 * sizeof(char), "%c", localtime(&logcat_entry->time));
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0); ImGui::TextUnformatted(time_as_str);
if (logcat_entry->user) {
ImGui::TableSetColumnIndex(1);
if (ImGui::TableSetColumnIndex(0)) ImGui::TextUnformatted(time_as_str);
if (logcat_entry->user && ImGui::TableSetColumnIndex(1)) {
ImGui::TextUnformatted(*logcat_entry->user);
}
ImGui::TableSetColumnIndex(2); ImGui::Text("%zu", logcat_entry->pid);
ImGui::TableSetColumnIndex(3); ImGui::Text("%zu", logcat_entry->tid);
ImGui::TableSetColumnIndex(4); ImGui::TextUnformatted(buffer_to(logcat_entry->buffer));
ImGui::TableSetColumnIndex(5); ImGui::TextUnformatted(priority_to(logcat_entry->priority));
ImGui::TableSetColumnIndex(6); ImGui::TextUnformatted(logcat_entry->tag);
ImGui::TableSetColumnIndex(7); ImGui::TextUnformatted(logcat_entry->message);
if (ImGui::TableSetColumnIndex(2)) ImGui::Text("%zu", logcat_entry->pid);
if (ImGui::TableSetColumnIndex(3)) ImGui::Text("%zu", logcat_entry->tid);
if (ImGui::TableSetColumnIndex(4)) ImGui::TextUnformatted(buffer_to(logcat_entry->buffer));
if (ImGui::TableSetColumnIndex(5)) ImGui::TextUnformatted(priority_to(logcat_entry->priority));
if (ImGui::TableSetColumnIndex(6)) ImGui::TextUnformatted(logcat_entry->tag);
if (ImGui::TableSetColumnIndex(7)) ImGui::TextUnformatted(logcat_entry->message);
}
}
clipper.End();