summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuan José Casafranca <juan.casafranca@kdab.com>2020-09-30 13:34:23 +0200
committerJuan José Casafranca <juan.casafranca@kdab.com>2020-10-02 14:29:40 +0200
commit6fdf835639e56c68ae01da894c7d2b9f552dd87d (patch)
treedce818c8ecdd8cc3115f35125ca2ff5b78f7307a
parent21f034e8cb02dc6fe22b6888dc159dc518c4bccf (diff)
Pass the raw data to the texture data extractor
Change-Id: If6ca151b22f442985df1ff34108ca0bd216ebf47 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--src/render/texture/qtextureimagedata.cpp4
-rw-r--r--src/render/texture/qtextureimagedata_p.h5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/render/texture/qtextureimagedata.cpp b/src/render/texture/qtextureimagedata.cpp
index 4841cebdf..849ea075e 100644
--- a/src/render/texture/qtextureimagedata.cpp
+++ b/src/render/texture/qtextureimagedata.cpp
@@ -89,7 +89,7 @@ QByteArray QTextureImageDataPrivate::data(int layer, int face, int mipmapLevel)
}
if (m_dataExtractor)
- return m_dataExtractor(layer, face, mipmapLevel);
+ return m_dataExtractor(m_data, layer, face, mipmapLevel);
if (m_isKtx)
return ktxData(layer, face, mipmapLevel);
@@ -117,7 +117,7 @@ void QTextureImageDataPrivate::setData(const QByteArray &data,
}
void QTextureImageDataPrivate::setData(const QByteArray &data,
- std::function<QByteArray(int layer, int face, int mipmapLevel)> dataExtractor,
+ std::function<QByteArray(QByteArray rawData, int layer, int face, int mipmapLevel)> dataExtractor,
bool isCompressed)
{
m_isCompressed = isCompressed;
diff --git a/src/render/texture/qtextureimagedata_p.h b/src/render/texture/qtextureimagedata_p.h
index 30968e199..53ff2ca30 100644
--- a/src/render/texture/qtextureimagedata_p.h
+++ b/src/render/texture/qtextureimagedata_p.h
@@ -53,6 +53,7 @@
#include "qtextureimagedata.h"
#include <Qt3DRender/private/qt3drender_global_p.h>
+#include <functional>
QT_BEGIN_NAMESPACE
@@ -65,7 +66,7 @@ public:
void setData(const QByteArray &data, int blockSize, bool isCompressed);
void setData(const QByteArray &data,
- std::function<QByteArray(int layer, int face, int mipmapLevel)> dataExtractor,
+ std::function<QByteArray(QByteArray, int, int, int)> dataExtractor,
bool isCompressed);
bool setCompressedFile(const QString &source);
@@ -93,7 +94,7 @@ public:
// public API changes. Consider https://codereview.qt-project.org/#/c/178474/ for Qt 6.
bool m_isKtx;
QByteArray m_data;
- std::function<QByteArray(int layer, int face, int mipmapLevel)> m_dataExtractor;
+ std::function<QByteArray(QByteArray rawData, int layer, int face, int mipmapLevel)> m_dataExtractor;
static QTextureImageDataPrivate *get(QTextureImageData *imageData);