MCPcopy Create free account
hub / github.com/Wemino/EchoPatch / DebugNodeTexture

Method DebugNodeTexture

include/imgui/imgui.cpp:16471–16502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16469}
16470
16471void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRect* highlight_rect)
16472{
16473 ImGuiContext& g = *GImGui;
16474 PushID(int_id);
16475 if (TreeNode("", "Texture #%03d (%dx%d pixels)", tex->UniqueID, tex->Width, tex->Height))
16476 {
16477 ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
16478 Checkbox("Show used rect", &cfg->ShowTextureUsedRect);
16479 PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
16480 ImVec2 p = GetCursorScreenPos();
16481 if (tex->WantDestroyNextFrame)
16482 Dummy(ImVec2((float)tex->Width, (float)tex->Height));
16483 else
16484 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));
16485 if (cfg->ShowTextureUsedRect)
16486 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));
16487 if (highlight_rect != NULL)
16488 {
16489 ImRect r_outer(p.x, p.y, p.x + tex->Width, p.y + tex->Height);
16490 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);
16491 RenderRectFilledWithHole(GetWindowDrawList(), r_outer, r_inner, IM_COL32(0, 0, 0, 100), 0.0f);
16492 GetWindowDrawList()->AddRect(r_inner.Min - ImVec2(1, 1), r_inner.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255));
16493 }
16494 PopStyleVar();
16495
16496 char texref_desc[30];
16497 Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors);
16498 Text("TexRef = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texref_desc, IM_COUNTOF(texref_desc), tex->GetTexRef()), tex->BackendUserData);
16499 TreePop();
16500 }
16501 PopID();
16502}
16503
16504void ImGui::ShowMetricsWindow(bool* p_open)
16505{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected