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
qsgcompressedatlastexture_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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
4#ifndef QSGCOMPRESSEDATLASTEXTURE_P_H
5#define QSGCOMPRESSEDATLASTEXTURE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/QSize>
19
20#include <QtQuick/QSGTexture>
21#include <QtQuick/private/qsgareaallocator_p.h>
22#include <QtQuick/private/qsgrhiatlastexture_p.h>
23
24QT_BEGIN_NAMESPACE
25
26class QSGCompressedTextureFactory;
27
29
30class Texture;
31
33{
34public:
35 Atlas(QSGDefaultRenderContext *rc, const QSize &size, uint format);
36 ~Atlas();
37
39 void enqueueTextureUpload(QSGRhiAtlasTexture::TextureBase *t,
40 QRhiResourceUpdateBatch *rcub) override;
41
42 Texture *create(QByteArrayView data, const QSize &size);
43
44 uint format() const { return m_format; }
45
46private:
47 uint m_format;
48};
49
51{
53public:
55 ~Texture();
56
57 QSize textureSize() const override { return m_size; }
58 bool hasAlphaChannel() const override;
59 bool hasMipmaps() const override { return false; }
60
61 QRectF normalizedTextureSubRect() const override { return m_texture_coords_rect; }
62
63 QSGTexture *removedFromAtlas(QRhiResourceUpdateBatch *) const override;
64
65 const QByteArray &data() const { return m_data; }
66 int sizeInBytes() const { return m_data.size(); }
67
68private:
69 QRectF m_texture_coords_rect;
70 mutable QSGTexture *m_nonatlas_texture;
71 QByteArray m_data;
72 QSize m_size;
73};
74
75}
76
77QT_END_NAMESPACE
78
79#endif
Texture * create(QByteArrayView data, const QSize &size)
void enqueueTextureUpload(QSGRhiAtlasTexture::TextureBase *t, QRhiResourceUpdateBatch *rcub) override
Atlas(QSGDefaultRenderContext *rc, const QSize &size, uint format)
bool hasAlphaChannel() const override
Returns true if the texture data contains an alpha channel.
bool hasMipmaps() const override
Returns true if the texture data contains mipmap levels.
QSGTexture * removedFromAtlas(QRhiResourceUpdateBatch *) const override
This function returns a copy of the current texture which is removed from its atlas.
QSize textureSize() const override
Returns the size of the texture in pixels.
QRectF normalizedTextureSubRect() const override
Returns the rectangle inside textureSize() that this texture represents in normalized coordinates.