From 316ab639502d6c119c35009b619b05456995f12d Mon Sep 17 00:00:00 2001 From: Tobias Markus Date: Sun, 17 Oct 2021 00:53:26 +0200 Subject: [PATCH] Reserve space for vectors before drawing #1301 #1851 --- src/video/gl/gl_painter.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/gl/gl_painter.cpp b/src/video/gl/gl_painter.cpp index 5bdeb4cee61..7614cacb2ba 100644 --- a/src/video/gl/gl_painter.cpp +++ b/src/video/gl/gl_painter.cpp @@ -77,6 +77,10 @@ GLPainter::draw_texture(const TextureRequest& request) std::vector vertices; std::vector 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();