MCPcopy Create free account
hub / github.com/PCSX2/pcsx2 / DebugNodeTexture

Method DebugNodeTexture

3rdparty/imgui/src/imgui.cpp:16562–16593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16560}
16561
16562void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRect* highlight_rect)
16563{
16564 ImGuiContext& g = *GImGui;
16565 PushID(int_id);
16566 if (TreeNode("", "Texture #%03d (%dx%d pixels)", tex->UniqueID, tex->Width, tex->Height))
16567 {
16568 ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
16569 Checkbox("Show used rect", &cfg->ShowTextureUsedRect);
16570 PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
16571 ImVec2 p = GetCursorScreenPos();
16572 if (tex->WantDestroyNextFrame)
16573 Dummy(ImVec2((float)tex->Width, (float)tex->Height));
16574 else
16575 ImageWithBg(tex->GetTexRef(), ImVec2((float)tex->Width, (float)tex->Height), ImVec2(0.0f, 0.0f), ImVec2(1.0f, 1.0f), ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
16576 if (cfg->ShowTextureUsedRect)
16577 GetWindowDrawList()->AddRect(ImVec2(p.x + tex->UsedRect.x, p.y + tex->UsedRect.y), ImVec2(p.x + tex->UsedRect.x + tex->UsedRect.w, p.y + tex->UsedRect.y + tex->UsedRect.h), IM_COL32(255, 0, 255, 255));
16578 if (highlight_rect != NULL)
16579 {
16580 ImRect r_outer(p.x, p.y, p.x + tex->Width, p.y + tex->Height);
16581 ImRect r_inner(p.x + highlight_rect->x, p.y + highlight_rect->y, p.x + highlight_rect->x + highlight_rect->w, p.y + highlight_rect->y + highlight_rect->h);
16582 RenderRectFilledWithHole(GetWindowDrawList(), r_outer, r_inner, IM_COL32(0, 0, 0, 100), 0.0f);
16583 GetWindowDrawList()->AddRect(r_inner.Min - ImVec2(1, 1), r_inner.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255));
16584 }
16585 PopStyleVar();
16586
16587 char texref_desc[30];
16588 Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors);
16589 Text("TexRef = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texref_desc, IM_COUNTOF(texref_desc), tex->GetTexRef()), tex->BackendUserData);
16590 TreePop();
16591 }
16592 PopID();
16593}
16594
16595void ImGui::ShowMetricsWindow(bool* p_open)
16596{

Callers

nothing calls this directly

Calls 8

ImMaxFunction · 0.85
ImVec4Class · 0.85
GetTexRefMethod · 0.80
ImVec2Function · 0.50
AddRectMethod · 0.45

Tested by

no test coverage detected