mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-22 11:57:00 +00:00
parent
c649aca20a
commit
1a9ddd2396
@ -49,7 +49,7 @@ Other changes:
|
|||||||
- ImDrawData: CmdLists[] array is now an ImVector<> owned by ImDrawData rather
|
- ImDrawData: CmdLists[] array is now an ImVector<> owned by ImDrawData rather
|
||||||
than a pointer to internal state.
|
than a pointer to internal state.
|
||||||
- This makes it easier for user to create their own or append to an existing draw data.
|
- This makes it easier for user to create their own or append to an existing draw data.
|
||||||
(#6406, #4879, #1878)
|
Added a ImDrawData::AddDrawList() helper function to do that. (#6406, #4879, #1878)
|
||||||
- This makes it easier to perform a deep-swap instead of a deep-copy, as array
|
- This makes it easier to perform a deep-swap instead of a deep-copy, as array
|
||||||
ownership is now clear. (#6597, #6475, #6167, #5776, #5109, #4763, #3515, #1860)
|
ownership is now clear. (#6597, #6475, #6167, #5776, #5109, #4763, #3515, #1860)
|
||||||
- Syntax and allocation count are otherwise identical.
|
- Syntax and allocation count are otherwise identical.
|
||||||
|
@ -4873,7 +4873,7 @@ static void SetupViewportDrawData(ImGuiViewportP* viewport)
|
|||||||
draw_data->DisplaySize = viewport->Size;
|
draw_data->DisplaySize = viewport->Size;
|
||||||
draw_data->FramebufferScale = io.DisplayFramebufferScale;
|
draw_data->FramebufferScale = io.DisplayFramebufferScale;
|
||||||
draw_data->OwnerViewport = viewport;
|
draw_data->OwnerViewport = viewport;
|
||||||
for (int n = 0; n < draw_data->CmdLists.Size; n++)
|
for (int n = 0; n < draw_data->CmdLists.Size; n++) // Similar to AddDrawList() but we are already added in the array
|
||||||
{
|
{
|
||||||
ImDrawList* draw_list = draw_data->CmdLists[n];
|
ImDrawList* draw_list = draw_data->CmdLists[n];
|
||||||
draw_list->_PopUnusedDrawCmd();
|
draw_list->_PopUnusedDrawCmd();
|
||||||
|
1
imgui.h
1
imgui.h
@ -2756,6 +2756,7 @@ struct ImDrawData
|
|||||||
// Functions
|
// Functions
|
||||||
ImDrawData() { Clear(); }
|
ImDrawData() { Clear(); }
|
||||||
IMGUI_API void Clear();
|
IMGUI_API void Clear();
|
||||||
|
IMGUI_API void AddDrawList(ImDrawList* draw_list); // Helper to add an external draw list into an existing ImDrawData.
|
||||||
IMGUI_API void DeIndexAllBuffers(); // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
IMGUI_API void DeIndexAllBuffers(); // Helper to convert all buffers from indexed to non-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
||||||
IMGUI_API void ScaleClipRects(const ImVec2& fb_scale); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.
|
IMGUI_API void ScaleClipRects(const ImVec2& fb_scale); // Helper to scale the ClipRect field of each ImDrawCmd. Use if your final output buffer is at a different scale than Dear ImGui expects, or if there is a difference between your window resolution and framebuffer resolution.
|
||||||
};
|
};
|
||||||
|
@ -1817,6 +1817,17 @@ void ImDrawData::Clear()
|
|||||||
OwnerViewport = NULL;
|
OwnerViewport = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ImDrawData::AddDrawList(ImDrawList* draw_list)
|
||||||
|
{
|
||||||
|
IM_ASSERT(Valid);
|
||||||
|
IM_ASSERT(CmdLists.Size == CmdListsCount);
|
||||||
|
draw_list->_PopUnusedDrawCmd();
|
||||||
|
CmdLists.push_back(draw_list);
|
||||||
|
CmdListsCount++;
|
||||||
|
TotalVtxCount += draw_list->VtxBuffer.Size;
|
||||||
|
TotalIdxCount += draw_list->IdxBuffer.Size;
|
||||||
|
}
|
||||||
|
|
||||||
// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
// For backward compatibility: convert all buffers from indexed to de-indexed, in case you cannot render indexed. Note: this is slow and most likely a waste of resources. Always prefer indexed rendering!
|
||||||
void ImDrawData::DeIndexAllBuffers()
|
void ImDrawData::DeIndexAllBuffers()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user