| 73 | } |
| 74 | |
| 75 | void 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 | |
| 100 | void ImGuiLayer::render() const { |
| 101 | ImGui::Render(); |
no test coverage detected