MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / DebugNodeTexture

Method DebugNodeTexture

imgui_tiny_app/imgui/imgui.cpp:22264–22295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22262}
22263
22264void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRect* highlight_rect)
22265{
22266 ImGuiContext& g = *GImGui;
22267 PushID(int_id);
22268 if (TreeNode("", "Texture #%03d (%dx%d pixels)", tex->UniqueID, tex->Width, tex->Height))
22269 {
22270 ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
22271 Checkbox("Show used rect", &cfg->ShowTextureUsedRect);
22272 PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
22273 ImVec2 p = GetCursorScreenPos();
22274 if (tex->WantDestroyNextFrame)
22275 Dummy(ImVec2((float)tex->Width, (float)tex->Height));
22276 else
22277 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));
22278 if (cfg->ShowTextureUsedRect)
22279 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));
22280 if (highlight_rect != NULL)
22281 {
22282 ImRect r_outer(p.x, p.y, p.x + tex->Width, p.y + tex->Height);
22283 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);
22284 RenderRectFilledWithHole(GetWindowDrawList(), r_outer, r_inner, IM_COL32(0, 0, 0, 100), 0.0f);
22285 GetWindowDrawList()->AddRect(r_inner.Min - ImVec2(1, 1), r_inner.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255));
22286 }
22287 PopStyleVar();
22288
22289 char texref_desc[30];
22290 Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors);
22291 Text("TexRef = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texref_desc, IM_COUNTOF(texref_desc), tex->GetTexRef()), tex->BackendUserData);
22292 TreePop();
22293 }
22294 PopID();
22295}
22296
22297void ImGui::ShowMetricsWindow(bool* p_open)
22298{

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected