diff options
author | Paul Olav Tvete <paul.tvete@qt.io> | 2022-05-25 08:59:13 +0200 |
---|---|---|
committer | Paul Olav Tvete <paul.tvete@qt.io> | 2022-05-27 20:54:44 +0200 |
commit | 9614f4d434474fe7dcca752b3f72a56f2d382230 (patch) | |
tree | f4d6550149c396c89e76d02491f0b9907a4f38b1 /src/gui/util/qtexturefiledata_p.h | |
parent | 5431b40ee87ade502825258d67304882a33f9294 (diff) |
Make it possible to create QTextureFileData from images
Currently it is only possible to create a cube map texture from a single
compressed texture file. In many cases, the cubemap asset is available
as a set of individual image files. Making it possible to use these
images directly will make the development process more efficient, and
will reduce the size of the assets needed to be shipped with demos and
examples.
Task-number: QTBUG-103191
Change-Id: Icd12548e2dab55ec2123804cb28353cbf29926ce
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
Diffstat (limited to 'src/gui/util/qtexturefiledata_p.h')
-rw-r--r-- | src/gui/util/qtexturefiledata_p.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/util/qtexturefiledata_p.h b/src/gui/util/qtexturefiledata_p.h index 189a590979..cd0dbe171c 100644 --- a/src/gui/util/qtexturefiledata_p.h +++ b/src/gui/util/qtexturefiledata_p.h @@ -30,7 +30,9 @@ class QTextureFileDataPrivate; class Q_GUI_EXPORT QTextureFileData { public: - QTextureFileData(); + enum Mode { ByteArrayMode, ImageMode }; + + QTextureFileData(Mode mode = ByteArrayMode); QTextureFileData(const QTextureFileData &other); QTextureFileData &operator=(const QTextureFileData &other); ~QTextureFileData(); @@ -42,6 +44,7 @@ public: QByteArray data() const; void setData(const QByteArray &data); + void setData(const QImage &image, int level = 0, int face = 0); int dataOffset(int level = 0, int face = 0) const; void setDataOffset(int offset, int level = 0, int face = 0); @@ -77,6 +80,7 @@ public: private: QSharedDataPointer<QTextureFileDataPrivate> d; + friend Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QTextureFileData &d); }; Q_DECLARE_TYPEINFO(QTextureFileData, Q_RELOCATABLE_TYPE); |