Internals: DrawData: renamed fields only (committing separately so that next commit is less nosiy).
This commit is contained in:
parent
514d30d8cd
commit
06eef2ce6f
60
imgui.cpp
60
imgui.cpp
@ -2246,7 +2246,7 @@ ImGuiStyle& ImGui::GetStyle()
|
|||||||
// Same value as passed to your RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()
|
// Same value as passed to your RenderDrawListsFn() function. valid after Render() and until the next call to NewFrame()
|
||||||
ImDrawData* ImGui::GetDrawData()
|
ImDrawData* ImGui::GetDrawData()
|
||||||
{
|
{
|
||||||
return GImGui->RenderDrawData.Valid ? &GImGui->RenderDrawData : NULL;
|
return GImGui->DrawData.Valid ? &GImGui->DrawData : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ImGui::GetTime()
|
float ImGui::GetTime()
|
||||||
@ -2303,9 +2303,9 @@ void ImGui::NewFrame()
|
|||||||
g.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
g.OverlayDrawList.Flags = (g.Style.AntiAliasedLines ? ImDrawListFlags_AntiAliasedLines : 0) | (g.Style.AntiAliasedFill ? ImDrawListFlags_AntiAliasedFill : 0);
|
||||||
|
|
||||||
// Mark rendering data as invalid to prevent user who may have a handle on it to use it
|
// Mark rendering data as invalid to prevent user who may have a handle on it to use it
|
||||||
g.RenderDrawData.Valid = false;
|
g.DrawData.Valid = false;
|
||||||
g.RenderDrawData.CmdLists = NULL;
|
g.DrawData.CmdLists = NULL;
|
||||||
g.RenderDrawData.CmdListsCount = g.RenderDrawData.TotalVtxCount = g.RenderDrawData.TotalIdxCount = 0;
|
g.DrawData.CmdListsCount = g.DrawData.TotalVtxCount = g.DrawData.TotalIdxCount = 0;
|
||||||
|
|
||||||
// Clear reference to active widget if the widget isn't alive anymore
|
// Clear reference to active widget if the widget isn't alive anymore
|
||||||
if (!g.HoveredIdPreviousFrame)
|
if (!g.HoveredIdPreviousFrame)
|
||||||
@ -2656,8 +2656,8 @@ void ImGui::Shutdown()
|
|||||||
g.FontStack.clear();
|
g.FontStack.clear();
|
||||||
g.OpenPopupStack.clear();
|
g.OpenPopupStack.clear();
|
||||||
g.CurrentPopupStack.clear();
|
g.CurrentPopupStack.clear();
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(g.DrawDataLists); i++)
|
||||||
g.RenderDrawLists[i].clear();
|
g.DrawDataLists[i].clear();
|
||||||
g.OverlayDrawList.ClearFreeMemory();
|
g.OverlayDrawList.ClearFreeMemory();
|
||||||
g.PrivateClipboard.clear();
|
g.PrivateClipboard.clear();
|
||||||
g.InputTextState.Text.clear();
|
g.InputTextState.Text.clear();
|
||||||
@ -2902,11 +2902,11 @@ static void AddWindowToRenderListSelectLayer(ImGuiWindow* window)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.IO.MetricsActiveWindows++;
|
g.IO.MetricsActiveWindows++;
|
||||||
if (window->Flags & ImGuiWindowFlags_Popup)
|
if (window->Flags & ImGuiWindowFlags_Popup)
|
||||||
AddWindowToRenderList(g.RenderDrawLists[1], window);
|
AddWindowToRenderList(g.DrawDataLists[1], window);
|
||||||
else if (window->Flags & ImGuiWindowFlags_Tooltip)
|
else if (window->Flags & ImGuiWindowFlags_Tooltip)
|
||||||
AddWindowToRenderList(g.RenderDrawLists[2], window);
|
AddWindowToRenderList(g.DrawDataLists[2], window);
|
||||||
else
|
else
|
||||||
AddWindowToRenderList(g.RenderDrawLists[0], window);
|
AddWindowToRenderList(g.DrawDataLists[0], window);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When using this function it is sane to ensure that float are perfectly rounded to integer values, to that e.g. (int)(max.x-min.x) in user's render produce correct result.
|
// When using this function it is sane to ensure that float are perfectly rounded to integer values, to that e.g. (int)(max.x-min.x) in user's render produce correct result.
|
||||||
@ -3031,8 +3031,8 @@ void ImGui::Render()
|
|||||||
{
|
{
|
||||||
// Gather windows to render
|
// Gather windows to render
|
||||||
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
|
g.IO.MetricsRenderVertices = g.IO.MetricsRenderIndices = g.IO.MetricsActiveWindows = 0;
|
||||||
for (int i = 0; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
for (int i = 0; i < IM_ARRAYSIZE(g.DrawDataLists); i++)
|
||||||
g.RenderDrawLists[i].resize(0);
|
g.DrawDataLists[i].resize(0);
|
||||||
for (int i = 0; i != g.Windows.Size; i++)
|
for (int i = 0; i != g.Windows.Size; i++)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = g.Windows[i];
|
ImGuiWindow* window = g.Windows[i];
|
||||||
@ -3041,17 +3041,17 @@ void ImGui::Render()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Flatten layers
|
// Flatten layers
|
||||||
int n = g.RenderDrawLists[0].Size;
|
int n = g.DrawDataLists[0].Size;
|
||||||
int flattened_size = n;
|
int flattened_size = n;
|
||||||
for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
for (int i = 1; i < IM_ARRAYSIZE(g.DrawDataLists); i++)
|
||||||
flattened_size += g.RenderDrawLists[i].Size;
|
flattened_size += g.DrawDataLists[i].Size;
|
||||||
g.RenderDrawLists[0].resize(flattened_size);
|
g.DrawDataLists[0].resize(flattened_size);
|
||||||
for (int i = 1; i < IM_ARRAYSIZE(g.RenderDrawLists); i++)
|
for (int i = 1; i < IM_ARRAYSIZE(g.DrawDataLists); i++)
|
||||||
{
|
{
|
||||||
ImVector<ImDrawList*>& layer = g.RenderDrawLists[i];
|
ImVector<ImDrawList*>& layer = g.DrawDataLists[i];
|
||||||
if (layer.empty())
|
if (layer.empty())
|
||||||
continue;
|
continue;
|
||||||
memcpy(&g.RenderDrawLists[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));
|
memcpy(&g.DrawDataLists[0][n], &layer[0], layer.Size * sizeof(ImDrawList*));
|
||||||
n += layer.Size;
|
n += layer.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3070,18 +3070,18 @@ void ImGui::Render()
|
|||||||
g.OverlayDrawList.PopTextureID();
|
g.OverlayDrawList.PopTextureID();
|
||||||
}
|
}
|
||||||
if (!g.OverlayDrawList.VtxBuffer.empty())
|
if (!g.OverlayDrawList.VtxBuffer.empty())
|
||||||
AddDrawListToRenderList(g.RenderDrawLists[0], &g.OverlayDrawList);
|
AddDrawListToRenderList(g.DrawDataLists[0], &g.OverlayDrawList);
|
||||||
|
|
||||||
// Setup draw data
|
// Setup draw data
|
||||||
g.RenderDrawData.Valid = true;
|
g.DrawData.Valid = true;
|
||||||
g.RenderDrawData.CmdLists = (g.RenderDrawLists[0].Size > 0) ? &g.RenderDrawLists[0][0] : NULL;
|
g.DrawData.CmdLists = (g.DrawDataLists[0].Size > 0) ? &g.DrawDataLists[0][0] : NULL;
|
||||||
g.RenderDrawData.CmdListsCount = g.RenderDrawLists[0].Size;
|
g.DrawData.CmdListsCount = g.DrawDataLists[0].Size;
|
||||||
g.RenderDrawData.TotalVtxCount = g.IO.MetricsRenderVertices;
|
g.DrawData.TotalVtxCount = g.IO.MetricsRenderVertices;
|
||||||
g.RenderDrawData.TotalIdxCount = g.IO.MetricsRenderIndices;
|
g.DrawData.TotalIdxCount = g.IO.MetricsRenderIndices;
|
||||||
|
|
||||||
// Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData()
|
// Render. If user hasn't set a callback then they may retrieve the draw data via GetDrawData()
|
||||||
if (g.RenderDrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL)
|
if (g.DrawData.CmdListsCount > 0 && g.IO.RenderDrawListsFn != NULL)
|
||||||
g.IO.RenderDrawListsFn(&g.RenderDrawData);
|
g.IO.RenderDrawListsFn(&g.DrawData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11749,11 +11749,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
|||||||
|
|
||||||
ImGuiContext& g = *GImGui; // Access private state
|
ImGuiContext& g = *GImGui; // Access private state
|
||||||
Funcs::NodeWindows(g.Windows, "Windows");
|
Funcs::NodeWindows(g.Windows, "Windows");
|
||||||
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.RenderDrawLists[0].Size))
|
if (ImGui::TreeNode("DrawList", "Active DrawLists (%d)", g.DrawDataLists[0].Size))
|
||||||
{
|
{
|
||||||
for (int layer = 0; layer < IM_ARRAYSIZE(g.RenderDrawLists); layer++)
|
for (int layer = 0; layer < IM_ARRAYSIZE(g.DrawDataLists); layer++)
|
||||||
for (int i = 0; i < g.RenderDrawLists[layer].Size; i++)
|
for (int i = 0; i < g.DrawDataLists[layer].Size; i++)
|
||||||
Funcs::NodeDrawList(g.RenderDrawLists[0][i], "DrawList");
|
Funcs::NodeDrawList(g.DrawDataLists[0][i], "DrawList");
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
}
|
}
|
||||||
if (ImGui::TreeNode("Popups", "Open Popups Stack (%d)", g.OpenPopupStack.Size))
|
if (ImGui::TreeNode("Popups", "Open Popups Stack (%d)", g.OpenPopupStack.Size))
|
||||||
|
@ -546,8 +546,8 @@ struct ImGuiContext
|
|||||||
ImGuiCond NextTreeNodeOpenCond;
|
ImGuiCond NextTreeNodeOpenCond;
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
ImDrawData RenderDrawData; // Main ImDrawData instance to pass render information to the user
|
ImDrawData DrawData; // Main ImDrawData instance to pass render information to the user
|
||||||
ImVector<ImDrawList*> RenderDrawLists[3];
|
ImVector<ImDrawList*> DrawDataLists[3];
|
||||||
float ModalWindowDarkeningRatio;
|
float ModalWindowDarkeningRatio;
|
||||||
ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
|
ImDrawList OverlayDrawList; // Optional software render of mouse cursors, if io.MouseDrawCursor is set + a few debug overlays
|
||||||
ImGuiMouseCursor MouseCursor;
|
ImGuiMouseCursor MouseCursor;
|
||||||
|
Loading…
Reference in New Issue
Block a user