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
qsgrhitextureglyphcache_p.h
Go to the documentation of this file.
1// Copyright (C) 2019 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 QSGRHITEXTUREGLYPHCACHE_P_H
5#define QSGRHITEXTUREGLYPHCACHE_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 <QtGui/private/qtextureglyphcache_p.h>
19#include <rhi/qrhi.h>
20
22
23class QSGDefaultRenderContext;
24
26{
27public:
28 QSGRhiTextureGlyphCache(QSGDefaultRenderContext *rc,
29 QFontEngine::GlyphFormat format, const QTransform &matrix,
30 const QColor &color = QColor());
32
33 void createTextureData(int width, int height) override;
34 void resizeTextureData(int width, int height) override;
36 void fillTexture(const Coord &c, glyph_t glyph, const QFixedPoint &subPixelPosition) override;
38 int glyphPadding() const override;
39 int maxTextureWidth() const override;
40 int maxTextureHeight() const override;
41
42 QRhiTexture *texture() const { return m_texture; }
43 void commitResourceUpdates(QRhiResourceUpdateBatch *mergeInto);
44
45 // Clamp the default -1 width and height to 0 for compatibility with
46 // QOpenGLTextureGlyphCache.
47 int width() const { return qMax(0, m_size.width()); }
48 int height() const { return qMax(0, m_size.height()); }
49
51
52private:
53 void prepareGlyphImage(QImage *img);
54 QRhiTexture *createEmptyTexture(QRhiTexture::Format format);
55
56 QSGDefaultRenderContext *m_rc;
57 QRhi *m_rhi;
58 bool m_resizeWithTextureCopy;
59 QRhiTexture *m_texture = nullptr;
60 QSize m_size;
61 bool m_bgra = false;
62 QVarLengthArray<QRhiTextureUploadEntry, 16> m_uploads;
63};
64
65QT_END_NAMESPACE
66
67#endif // QSGRHITEXTUREGLYPHCACHE_P_H
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:661
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:721
void resizeTextureData(int width, int height) override
void commitResourceUpdates(QRhiResourceUpdateBatch *mergeInto)
int maxTextureHeight() const override
QSGRhiTextureGlyphCache(QSGDefaultRenderContext *rc, QFontEngine::GlyphFormat format, const QTransform &matrix, const QColor &color=QColor())
void fillTexture(const Coord &c, glyph_t glyph, const QFixedPoint &subPixelPosition) override
void createTextureData(int width, int height) override
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13
constexpr int qRed(QRgb rgb)
Definition qrgb.h:18
constexpr int qGreen(QRgb rgb)
Definition qrgb.h:21
constexpr QRgb qRgba(int r, int g, int b, int a)
Definition qrgb.h:33
constexpr int qBlue(QRgb rgb)
Definition qrgb.h:24