Textures: ImTextureData::Create() sets status. RegisterUserTexture() increases RefCount. Added comments about ImTextureData::GetTexRef(). (#8789)

This commit is contained in:
ocornut
2025-07-11 16:40:35 +02:00
parent 0e6e876f23
commit a0d3e405a3
5 changed files with 14 additions and 7 deletions

View File

@@ -8732,16 +8732,19 @@ ImFont* ImGui::GetDefaultFont()
return g.IO.FontDefault ? g.IO.FontDefault : atlas->Fonts[0];
}
// EXPERIMENTAL: DO NOT USE YET.
void ImGui::RegisterUserTexture(ImTextureData* tex)
{
ImGuiContext& g = *GImGui;
IM_ASSERT(tex->RefCount > 0);
tex->RefCount++;
g.UserTextures.push_back(tex);
}
void ImGui::UnregisterUserTexture(ImTextureData* tex)
{
ImGuiContext& g = *GImGui;
IM_ASSERT(tex->RefCount > 0);
tex->RefCount--;
g.UserTextures.find_erase(tex);
}