Viewports: Report minimized viewports as zero DisplaySize to be consistent with main branch + comments (#1542)
This commit is contained in:
parent
615e9ae345
commit
0fe5170bc4
@ -4363,6 +4363,13 @@ void ImDrawDataBuilder::FlattenIntoSingleLayer()
|
||||
|
||||
static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector<ImDrawList*>* draw_lists)
|
||||
{
|
||||
// When minimized, we report draw_data->DisplaySize as zero to be consistent with non-viewport mode,
|
||||
// and to allow applications/back-ends to easily skip rendering.
|
||||
// FIXME: Note that we however do NOT attempt to report "zero drawlist / vertices" into the ImDrawData structure.
|
||||
// This is because the work has been done already, and its wasted! We should fix that and add optimizations for
|
||||
// it earlier in the pipeline, rather than pretend to hide the data at the end of the pipeline.
|
||||
const bool is_minimized = (viewport->Flags & ImGuiViewportFlags_Minimized) != 0;
|
||||
|
||||
ImDrawData* draw_data = &viewport->DrawDataP;
|
||||
viewport->DrawData = draw_data; // Make publicly accessible
|
||||
draw_data->Valid = true;
|
||||
@ -4370,7 +4377,7 @@ static void SetupViewportDrawData(ImGuiViewportP* viewport, ImVector<ImDrawList*
|
||||
draw_data->CmdListsCount = draw_lists->Size;
|
||||
draw_data->TotalVtxCount = draw_data->TotalIdxCount = 0;
|
||||
draw_data->DisplayPos = viewport->Pos;
|
||||
draw_data->DisplaySize = viewport->Size;
|
||||
draw_data->DisplaySize = is_minimized ? ImVec2(0.0f, 0.0f) : viewport->Size;
|
||||
draw_data->FramebufferScale = ImGui::GetIO().DisplayFramebufferScale; // FIXME-VIEWPORT: This may vary on a per-monitor/viewport basis?
|
||||
draw_data->OwnerViewport = viewport;
|
||||
for (int n = 0; n < draw_lists->Size; n++)
|
||||
|
Loading…
Reference in New Issue
Block a user