| 16469 | } |
| 16470 | |
| 16471 | void 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 | |
| 16504 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 16505 | { |
nothing calls this directly
no test coverage detected