Show the variables pane even when it is empty.

The widget layout shouldn't change when there are no variables.

Change-Id: Iedb48642486944127fa800072c1f4c57a574b513
Bug: skia:12666
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484836
Reviewed-by: Brian Osman <brianosman@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-12-15 13:11:32 -05:00 committed by SkCQ
parent 16a06174df
commit 457f1b9f41

View File

@ -186,21 +186,19 @@ void SkSLDebuggerSlide::showVariableTable() {
} else {
vars = fPlayer.getGlobalVariables();
}
if (vars.empty()) {
return;
}
ImVec2 varViewSize = ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * kNumTopRows);
if (ImGui::BeginTable("Variables", /*column=*/2, kTableFlags, varViewSize)) {
ImGui::TableSetupColumn("Variable", kColumnFlags);
ImGui::TableSetupColumn("Value", kColumnFlags);
ImGui::TableHeadersRow();
if (!vars.empty()) {
ImGuiListClipper clipper;
clipper.Begin(vars.size());
while (clipper.Step()) {
for (int row = clipper.DisplayStart; row < clipper.DisplayEnd; row++) {
const SkSL::SkVMDebugTracePlayer::VariableData& var = vars.at(row);
SkASSERT(var.fSlotIndex >= 0 && (size_t)var.fSlotIndex < fTrace->fSlotInfo.size());
SkASSERT(var.fSlotIndex >= 0);
SkASSERT((size_t)var.fSlotIndex < fTrace->fSlotInfo.size());
const SkSL::SkVMSlotInfo& slotInfo = fTrace->fSlotInfo[var.fSlotIndex];
ImGui::TableNextRow();
@ -216,6 +214,7 @@ void SkSLDebuggerSlide::showVariableTable() {
ImGui::Text("%s", fTrace->getSlotValue(var.fSlotIndex, var.fValue).c_str());
}
}
}
ImGui::EndTable();
}
}