mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-01 02:37:24 +01:00
Settings: Minor optimization to reduce calls in SettingsHandlerWindow_WriteAll.
This commit is contained in:
parent
d52c6316c8
commit
71d20abbc3
@ -9558,6 +9558,8 @@ ImGuiWindowSettings* ImGui::CreateNewWindowSettings(const char* name)
|
|||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
g.SettingsWindows.push_back(ImGuiWindowSettings());
|
g.SettingsWindows.push_back(ImGuiWindowSettings());
|
||||||
ImGuiWindowSettings* settings = &g.SettingsWindows.back();
|
ImGuiWindowSettings* settings = &g.SettingsWindows.back();
|
||||||
|
if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
||||||
|
name = p;
|
||||||
settings->Name = ImStrdup(name);
|
settings->Name = ImStrdup(name);
|
||||||
settings->ID = ImHashStr(name);
|
settings->ID = ImHashStr(name);
|
||||||
return settings;
|
return settings;
|
||||||
@ -9743,10 +9745,7 @@ static void SettingsHandlerWindow_WriteAll(ImGuiContext* ctx, ImGuiSettingsHandl
|
|||||||
const ImGuiWindowSettings* settings = &g.SettingsWindows[i];
|
const ImGuiWindowSettings* settings = &g.SettingsWindows[i];
|
||||||
if (settings->Pos.x == FLT_MAX)
|
if (settings->Pos.x == FLT_MAX)
|
||||||
continue;
|
continue;
|
||||||
const char* name = settings->Name;
|
buf->appendf("[%s][%s]\n", handler->TypeName, settings->Name);
|
||||||
if (const char* p = strstr(name, "###")) // Skip to the "###" marker if any. We don't skip past to match the behavior of GetID()
|
|
||||||
name = p;
|
|
||||||
buf->appendf("[%s][%s]\n", handler->TypeName, name);
|
|
||||||
buf->appendf("Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y);
|
buf->appendf("Pos=%d,%d\n", (int)settings->Pos.x, (int)settings->Pos.y);
|
||||||
buf->appendf("Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y);
|
buf->appendf("Size=%d,%d\n", (int)settings->Size.x, (int)settings->Size.y);
|
||||||
buf->appendf("Collapsed=%d\n", settings->Collapsed);
|
buf->appendf("Collapsed=%d\n", settings->Collapsed);
|
||||||
|
Loading…
Reference in New Issue
Block a user