MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / InitViewportDrawData

Function InitViewportDrawData

imgui_tiny_app/imgui/imgui.cpp:6051–6077  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6049}
6050
6051static void InitViewportDrawData(ImGuiViewportP* viewport)
6052{
6053 ImGuiIO& io = ImGui::GetIO();
6054 ImDrawData* draw_data = &viewport->DrawDataP;
6055
6056 viewport->DrawData = draw_data; // Make publicly accessible
6057 viewport->DrawDataBuilder.Layers[0] = &draw_data->CmdLists;
6058 viewport->DrawDataBuilder.Layers[1] = &viewport->DrawDataBuilder.LayerData1;
6059 viewport->DrawDataBuilder.Layers[0]->resize(0);
6060 viewport->DrawDataBuilder.Layers[1]->resize(0);
6061
6062 // When minimized, we report draw_data->DisplaySize as zero to be consistent with non-viewport mode,
6063 // and to allow applications/backends to easily skip rendering.
6064 // FIXME: Note that we however do NOT attempt to report "zero drawlist / vertices" into the ImDrawData structure.
6065 // This is because the work has been done already, and its wasted! We should fix that and add optimizations for
6066 // it earlier in the pipeline, rather than pretend to hide the data at the end of the pipeline.
6067 const bool is_minimized = (viewport->Flags & ImGuiViewportFlags_IsMinimized) != 0;
6068
6069 draw_data->Valid = true;
6070 draw_data->CmdListsCount = 0;
6071 draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;
6072 draw_data->DisplayPos = viewport->Pos;
6073 draw_data->DisplaySize = is_minimized ? ImVec2(0.0f, 0.0f) : viewport->Size;
6074 draw_data->FramebufferScale = (viewport->FramebufferScale.x != 0.0f) ? viewport->FramebufferScale : io.DisplayFramebufferScale;
6075 draw_data->OwnerViewport = viewport;
6076 draw_data->Textures = &ImGui::GetPlatformIO().Textures;
6077}
6078
6079// Push a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering.
6080// - When using this function it is sane to ensure that float are perfectly rounded to integer values,

Callers 1

RenderMethod · 0.85

Calls 2

ImVec2Function · 0.85
resizeMethod · 0.45

Tested by

no test coverage detected