MCPcopy Create free account
hub / github.com/OpenImageDebugger/OpenImageDebugger / begin_frame

Method begin_frame

src/host/imgui_layer.cpp:75–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75void ImGuiLayer::begin_frame() {
76 // Size the canvas/GLFW window BEFORE ImGui_ImplGlfw_NewFrame: the
77 // backend derives DisplaySize (logical points) and
78 // DisplayFramebufferScale from fresh state. Font-atlas work (display
79 // scale changes) also happens before ImGui_ImplOpenGL3_NewFrame so the
80 // destroyed font texture is recreated in the same frame. Both are
81 // platform no-ops on native.
82 oid::platform::sync_canvas_size(window_);
83 if (const auto scale = oid::platform::refresh_display_scale(content_scale_);
84 scale.has_value()) {
85 content_scale_ = *scale;
86 ImGuiIO& io = ImGui::GetIO();
87 io.Fonts->Clear();
88 setup_ui_fonts(content_scale_);
89 io.Fonts->Build();
90 ImGui_ImplOpenGL3_DestroyFontsTexture();
91 }
92 ImGui_ImplOpenGL3_NewFrame();
93 ImGui_ImplGlfw_NewFrame();
94 // Stuck-button recovery must run between the backend NewFrame and
95 // ImGui::NewFrame so an injected release resolves this frame.
96 oid::platform::reconcile_pointer_state();
97 ImGui::NewFrame();
98}
99
100void ImGuiLayer::render() const {
101 ImGui::Render();

Callers 2

mainFunction · 0.45
tickMethod · 0.45

Calls 4

sync_canvas_sizeFunction · 0.85
refresh_display_scaleFunction · 0.85
setup_ui_fontsFunction · 0.85
reconcile_pointer_stateFunction · 0.85

Tested by

no test coverage detected