| 5261 | } |
| 5262 | |
| 5263 | static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector<ImDrawList*>* draw_lists) |
| 5264 | { |
| 5265 | // When minimized, we report draw_data->DisplaySize as zero to be consistent with non-viewport mode, |
| 5266 | // and to allow applications/backends to easily skip rendering. |
| 5267 | // FIXME: Note that we however do NOT attempt to report "zero drawlist / vertices" into the ImDrawData structure. |
| 5268 | // This is because the work has been done already, and its wasted! We should fix that and add optimizations for |
| 5269 | // it earlier in the pipeline, rather than pretend to hide the data at the end of the pipeline. |
| 5270 | const bool is_minimized = (viewport->Flags & ImGuiViewportFlags_Minimized) != 0; |
| 5271 | |
| 5272 | ImGuiIO& io = ImGui::GetIO(); |
| 5273 | ImDrawData* draw_data = &viewport->DrawDataP; |
| 5274 | viewport->DrawData = draw_data; // Make publicly accessible |
| 5275 | draw_data->Valid = true; |
| 5276 | draw_data->CmdLists = (draw_lists->Size > 0) ? draw_lists->Data : NULL; |
| 5277 | draw_data->CmdListsCount = draw_lists->Size; |
| 5278 | draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0; |
| 5279 | draw_data->DisplayPos = viewport->Pos; |
| 5280 | draw_data->DisplaySize = is_minimized ? ImVec2(0.0f, 0.0f) : viewport->Size; |
| 5281 | draw_data->FramebufferScale = io.DisplayFramebufferScale; // FIXME-VIEWPORT: This may vary on a per-monitor/viewport basis? |
| 5282 | draw_data->OwnerViewport = viewport; |
| 5283 | for (int n = 0; n < draw_lists->Size; n++) |
| 5284 | { |
| 5285 | ImDrawList* draw_list = draw_lists->Data[n]; |
| 5286 | draw_list->_PopUnusedDrawCmd(); |
| 5287 | draw_data->TotalVtxCount += draw_list->VtxBuffer.Size; |
| 5288 | draw_data->TotalIdxCount += draw_list->IdxBuffer.Size; |
| 5289 | } |
| 5290 | } |
| 5291 | |
| 5292 | // Push a clipping rectangle for both ImGui logic (hit-testing etc.) and low-level ImDrawList rendering. |
| 5293 | // - When using this function it is sane to ensure that float are perfectly rounded to integer values, |
no test coverage detected