Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Platforms Sans-Alloca with Custom Backend Virtual Keyboard #5724

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions imgui_draw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,12 @@ void ImDrawList::AddPolyline(const ImVec2* points, const int points_count, ImU32

// Temporary buffer
// The first <points_count> items are normals at each line point, then after that there are either 2 or 4 temp points for each line point
#ifdef __WIIU__
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could exist as a general IMGUI_AVOID_ALLOCA flag or something?

// avoid using alloca on the Wii U
ImVec2 temp_normals[points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)]; //-V630
#else
ImVec2* temp_normals = (ImVec2*)alloca(points_count * ((use_texture || !thick_line) ? 3 : 5) * sizeof(ImVec2)); //-V630
#endif
ImVec2* temp_points = temp_normals + points_count;

// Calculate normals (tangents) for each line segment
Expand Down Expand Up @@ -1001,7 +1006,12 @@ void ImDrawList::AddConvexPolyFilled(const ImVec2* points, const int points_coun
}

// Compute normals
#ifdef __WIIU__
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could exist as a general IMGUI_AVOID_ALLOCA flag or something?

// Avoid using alloca on the Wii U
ImVec2 temp_normals[points_count * sizeof(ImVec2)]; //-V630
#else
ImVec2* temp_normals = (ImVec2*)alloca(points_count * sizeof(ImVec2)); //-V630
#endif
for (int i0 = points_count - 1, i1 = 0; i1 < points_count; i0 = i1++)
{
const ImVec2& p0 = points[i0];
Expand Down
2 changes: 2 additions & 0 deletions imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4591,8 +4591,10 @@ bool ImGui::InputTextEx(const char* label, const char* hint, char* buf, int buf_
}
}

#ifndef __WIIU__
// Clear temporary user storage
state->Flags = ImGuiInputTextFlags_None;
#endif
}

// Copy result to user buffer. This can currently only happen when (g.ActiveId == id)
Expand Down