mirror of
https://github.com/ocornut/imgui.git
synced 2026-03-01 14:48:28 +00:00
Textures: Added ImTextureData::UsedRect.
# Conflicts: # imgui_internal.h
This commit is contained in:
@@ -15724,10 +15724,13 @@ void ImGui::DebugNodeTexture(ImTextureData* tex)
|
||||
ImGuiContext& g = *GImGui;
|
||||
if (TreeNode(tex, "Texture #%03d (%dx%d pixels)", tex->UniqueID, tex->Width, tex->Height))
|
||||
{
|
||||
ImGuiMetricsConfig* cfg = &g.DebugMetricsConfig;
|
||||
Checkbox("Show used rect", &cfg->ShowTextureUsedRect);
|
||||
PushStyleVar(ImGuiStyleVar_ImageBorderSize, ImMax(1.0f, g.Style.ImageBorderSize));
|
||||
ImTextureRef tex_id;
|
||||
tex_id._TexData = tex; // Don't use tex->TexID directly so first frame works.
|
||||
ImageWithBg(tex_id, 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));
|
||||
ImVec2 p = GetCursorScreenPos();
|
||||
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));
|
||||
if (cfg->ShowTextureUsedRect)
|
||||
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));
|
||||
PopStyleVar();
|
||||
|
||||
char texid_desc[20];
|
||||
|
||||
Reference in New Issue
Block a user