Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsgcompressedtexture_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QSGCOMPRESSEDTEXTURE_P_H
6#define QSGCOMPRESSEDTEXTURE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qtexturefiledata_p.h>
20#include <private/qsgcontext_p.h>
21#include <private/qsgtexture_p.h>
22#include <rhi/qrhi.h>
23#include <QQuickTextureFactory>
24#include <QOpenGLFunctions>
25
27
28Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TEXTUREIO);
29
30class Q_QUICK_EXPORT QSGCompressedTexture : public QSGTexture
31{
32 Q_OBJECT
33public:
34 QSGCompressedTexture(const QTextureFileData& texData);
35 virtual ~QSGCompressedTexture();
36
37 QSize textureSize() const override;
38 bool hasAlphaChannel() const override;
39 bool hasMipmaps() const override;
40
41 qint64 comparisonKey() const override;
42 QRhiTexture *rhiTexture() const override;
43 void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
44
45 QTextureFileData textureData() const;
46
47 struct FormatInfo
48 {
49 QRhiTexture::Format rhiFormat;
50 bool isSRGB;
51 };
52 static FormatInfo formatInfo(quint32 glTextureFormat);
53 static bool formatIsOpaque(quint32 glTextureFormat);
54
55protected:
56 QTextureFileData m_textureData;
57 QSize m_size;
58 QRhiTexture *m_texture = nullptr;
59 bool m_hasAlpha = false;
60 bool m_uploaded = false;
61};
62
64 class Manager;
65}
66
67class Q_QUICK_EXPORT QSGCompressedTextureFactory : public QQuickTextureFactory
68{
69public:
70 QSGCompressedTextureFactory(const QTextureFileData& texData);
71 QSGTexture *createTexture(QQuickWindow *) const override;
72 int textureByteCount() const override;
73 QSize textureSize() const override;
74
75 const QTextureFileData *textureData() const { return &m_textureData; }
76
77protected:
78 QTextureFileData m_textureData;
79};
80
81QT_END_NAMESPACE
82
83#endif // QSGCOMPRESSEDTEXTURE_P_H
Combined button and popup list for selecting options.