UV: avoid small allocations in PackIsland::finalize_geometry

Use the memory arena for convex vertices as well as the index buffer.
This commit is contained in:
Campbell Barton
2024-04-26 13:55:37 +10:00
parent b9879b0ff7
commit 56f80ebbcd

View File

@@ -358,11 +358,12 @@ void PackIsland::finalize_geometry_(const UVPackIsland_Params &params, MemArena
if (convex_len >= 3) {
/* Write back. */
triangle_vertices_.clear();
Array<float2> convexVertices(convex_len);
float2 *convex_verts = static_cast<float2 *>(
BLI_memarena_alloc(arena, sizeof(*convex_verts) * convex_len));
for (int i = 0; i < convex_len; i++) {
convexVertices[i] = source[index_map[i]];
convex_verts[i] = source[index_map[i]];
}
add_polygon(convexVertices, arena, heap);
add_polygon(Span(convex_verts, convex_len), arena, heap);
}
}