mirror of
https://github.com/ocornut/imgui.git
synced 2026-01-05 21:07:51 +00:00
Textures: Single Textures[] array allows backend to not have to care about atlases.
# Conflicts: # imgui.h
This commit is contained in:
15
imgui.cpp
15
imgui.cpp
@@ -1271,6 +1271,7 @@ static void UpdateKeyRoutingTable(ImGuiKeyRoutingTable* rt);
|
||||
// Misc
|
||||
static void UpdateFontsNewFrame();
|
||||
static void UpdateTexturesNewFrame();
|
||||
static void UpdateTexturesEndFrame();
|
||||
static void UpdateSettings();
|
||||
static int UpdateWindowManualResize(ImGuiWindow* window, const ImVec2& size_auto_fit, int* border_hovered, int* border_held, int resize_grip_count, ImU32 resize_grip_col[4], const ImRect& visibility_rect);
|
||||
static void RenderWindowOuterBorders(ImGuiWindow* window);
|
||||
@@ -5182,6 +5183,18 @@ static void ImGui::UpdateTexturesNewFrame()
|
||||
ImFontAtlasUpdateNewFrame(atlas);
|
||||
}
|
||||
|
||||
// Build a single texture list
|
||||
// We want to avoid user reading from atlas->TexList[] in order to facilitate better support for multiple atlases.
|
||||
static void ImGui::UpdateTexturesEndFrame()
|
||||
{
|
||||
ImGuiContext& g = *GImGui;
|
||||
ImFontAtlas* atlas = g.IO.Fonts;
|
||||
g.PlatformIO.Textures.resize(0);
|
||||
g.PlatformIO.Textures.reserve(atlas->TexList.Size);
|
||||
for (ImTextureData* tex : atlas->TexList)
|
||||
g.PlatformIO.Textures.push_back(tex);
|
||||
}
|
||||
|
||||
// Called once a frame. Followed by SetCurrentFont() which sets up the remaining data.
|
||||
// FIXME-VIEWPORT: the concept of a single ClipRectFullscreen is not ideal!
|
||||
static void SetupDrawListSharedData()
|
||||
@@ -5759,6 +5772,8 @@ void ImGui::EndFrame()
|
||||
g.Windows.swap(g.WindowsTempSortBuffer);
|
||||
g.IO.MetricsActiveWindows = g.WindowsActiveCount;
|
||||
|
||||
UpdateTexturesEndFrame();
|
||||
|
||||
// Unlock font atlas
|
||||
g.IO.Fonts->Locked = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user