mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-05 16:51:07 -07:00
ENH:optimize mem usage of imgui fonts loading
Change-Id: Icdd88b119c4406c407a955240698da5187f8efd8
This commit is contained in:
parent
41fcf8eb1e
commit
316ca3f5f5
4 changed files with 84 additions and 41 deletions
|
|
@ -138,7 +138,7 @@ void GLGizmoText::pop_combo_style()
|
|||
// BBS
|
||||
void GLGizmoText::on_render_input_window(float x, float y, float bottom_limit)
|
||||
{
|
||||
static std::vector<std::string> m_avail_font_names = wxGetApp().imgui()->get_fonts_names();
|
||||
std::vector<std::string> m_avail_font_names = wxGetApp().imgui()->get_fonts_names();
|
||||
|
||||
const float win_h = ImGui::GetWindowHeight();
|
||||
y = std::min(y, bottom_limit - win_h);
|
||||
|
|
|
|||
|
|
@ -1484,6 +1484,9 @@ bool GLGizmosManager::activate_gizmo(EType type)
|
|||
GLGizmoBase* new_gizmo = type == Undefined ? nullptr : m_gizmos[type].get();
|
||||
|
||||
if (old_gizmo) {
|
||||
if (m_current == Text) {
|
||||
wxGetApp().imgui()->destroy_fonts_texture();
|
||||
}
|
||||
old_gizmo->set_state(GLGizmoBase::Off);
|
||||
if (old_gizmo->get_state() != GLGizmoBase::Off)
|
||||
return false; // gizmo refused to be turned off, do nothing.
|
||||
|
|
@ -1503,8 +1506,12 @@ bool GLGizmosManager::activate_gizmo(EType type)
|
|||
|
||||
m_current = type;
|
||||
|
||||
if (new_gizmo)
|
||||
if (new_gizmo) {
|
||||
if (m_current == Text) {
|
||||
wxGetApp().imgui()->load_fonts_texture();
|
||||
}
|
||||
new_gizmo->set_state(GLGizmoBase::On);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue