summaryrefslogtreecommitdiffstats
path: root/src/plugins/renderers/opengl/textures/gltexture.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-07-06 08:43:10 +0200
committerPaul Lemire <paul.lemire@kdab.com>2020-07-07 17:57:43 +0200
commitee6b0094a1b8f750b0be19fd6372ff85261750b0 (patch)
tree1107d6a5dd1c65bfab80569218f4d443398cd19c /src/plugins/renderers/opengl/textures/gltexture.cpp
parente5e7073c9750fe7a29d02011ffc98299bcee811c (diff)
GLTexture: change internals to use std::vector
Change-Id: If680702aed4544395866a7b376db920561bf16cc Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'src/plugins/renderers/opengl/textures/gltexture.cpp')
-rw-r--r--src/plugins/renderers/opengl/textures/gltexture.cpp22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/plugins/renderers/opengl/textures/gltexture.cpp b/src/plugins/renderers/opengl/textures/gltexture.cpp
index a44ef6877..f0cd34de1 100644
--- a/src/plugins/renderers/opengl/textures/gltexture.cpp
+++ b/src/plugins/renderers/opengl/textures/gltexture.cpp
@@ -55,6 +55,7 @@
#include <Qt3DRender/private/qabstracttexture_p.h>
#include <Qt3DRender/private/qtextureimagedata_p.h>
#include <renderbuffer_p.h>
+#include <Qt3DCore/private/vector_helper_p.h>
#if !QT_CONFIG(opengles2)
#include <QOpenGLFunctions_3_1>
@@ -404,19 +405,10 @@ void GLTexture::setProperties(const TextureProperties &props)
}
}
-void GLTexture::setImages(const QVector<Image> &images)
+void GLTexture::setImages(const std::vector<Image> &images)
{
// check if something has changed at all
- bool same = (images.size() == m_images.size());
- if (same) {
- for (int i = 0; i < images.size(); i++) {
- if (images[i] != m_images[i]) {
- same = false;
- break;
- }
- }
- }
-
+ const bool same = (images == m_images);
if (!same) {
m_images = images;
@@ -440,9 +432,9 @@ void GLTexture::setSharedTextureId(int textureId)
}
}
-void GLTexture::addTextureDataUpdates(const QVector<QTextureDataUpdate> &updates)
+void GLTexture::addTextureDataUpdates(const std::vector<QTextureDataUpdate> &updates)
{
- m_pendingTextureDataUpdates += updates;
+ Qt3DCore::append(m_pendingTextureDataUpdates, updates);
requestUpload();
}
@@ -560,7 +552,7 @@ void GLTexture::uploadGLTextureData()
}
// Upload all QTexImageData references by the TextureImages
- for (int i = 0; i < std::min(m_images.size(), m_imageData.size()); i++) {
+ for (size_t i = 0; i < std::min(m_images.size(), m_imageData.size()); i++) {
const QTextureImageDataPtr &imgData = m_imageData.at(i);
// Here the bytes in the QTextureImageData contain data for a single
// layer, face or mip level, unlike the QTextureGenerator case where
@@ -575,7 +567,7 @@ void GLTexture::uploadGLTextureData()
m_imageData.clear();
// Update data from TextureUpdates
- const QVector<QTextureDataUpdate> textureDataUpdates = std::move(m_pendingTextureDataUpdates);
+ const std::vector<QTextureDataUpdate> textureDataUpdates = std::move(m_pendingTextureDataUpdates);
for (const QTextureDataUpdate &update : textureDataUpdates) {
const QTextureImageDataPtr imgData = update.data();