| 16138 | } |
| 16139 | |
| 16140 | void ImGui::DebugNodeTexture(ImTextureData* tex, int int_id, const ImFontAtlasRect* highlight_rect) |
| 16141 | { |
| 16142 | ImGuiContext& g = *GImGui; |
| 16143 | PushID(int_id); |
| 16144 | if (TreeNode("", "Texture #%03d (%dx%d pixels)", tex->UniqueID, tex->Width, tex->Height)) |
| 16145 | { |
| 16146 | ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig; |
| 16147 | Checkbox("Show used rect", &cfg->ShowTextureUsedRect); |
| 16148 | PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize)); |
| 16149 | ImVec2 p = GetCursorScreenPos(); |
| 16150 | if (tex->WantDestroyNextFrame) |
| 16151 | Dummy(ImVec2((float)tex->Width, (float)tex->Height)); |
| 16152 | else |
| 16153 | 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)); |
| 16154 | if (cfg->ShowTextureUsedRect) |
| 16155 | 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)); |
| 16156 | if (highlight_rect != NULL) |
| 16157 | { |
| 16158 | ImRect r_outer(p.x, p.y, p.x + tex->Width, p.y + tex->Height); |
| 16159 | 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); |
| 16160 | RenderRectFilledWithHole(GetWindowDrawList(), r_outer, r_inner, IM_COL32(0, 0, 0, 100), 0.0f); |
| 16161 | GetWindowDrawList()->AddRect(r_inner.Min - ImVec2(1, 1), r_inner.Max + ImVec2(1, 1), IM_COL32(255, 255, 0, 255)); |
| 16162 | } |
| 16163 | PopStyleVar(); |
| 16164 | |
| 16165 | char texid_desc[30]; |
| 16166 | Text("Status = %s (%d), Format = %s (%d), UseColors = %d", ImTextureDataGetStatusName(tex->Status), tex->Status, ImTextureDataGetFormatName(tex->Format), tex->Format, tex->UseColors); |
| 16167 | Text("TexID = %s, BackendUserData = %p", FormatTextureRefForDebugDisplay(texid_desc, IM_ARRAYSIZE(texid_desc), tex->GetTexRef()), tex->BackendUserData); |
| 16168 | TreePop(); |
| 16169 | } |
| 16170 | PopID(); |
| 16171 | } |
| 16172 | |
| 16173 | void ImGui::ShowMetricsWindow(bool* p_open) |
| 16174 | { |
nothing calls this directly
no test coverage detected