Skip to content

Commit

Permalink
Reserve space for vectors before drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Oct 16, 2021
1 parent 6914916 commit 316ab63
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/video/gl/gl_painter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ GLPainter::draw_texture(const TextureRequest& request)

std::vector<float> vertices;
std::vector<float> uvs;

vertices.reserve(request.srcrects.size() * 12);
uvs.reserve(request.srcrects.size() * 12);

for (size_t i = 0; i < request.srcrects.size(); ++i)
{
const float left = request.dstrects[i].get_left();
Expand Down

0 comments on commit 316ab63

Please sign in to comment.