Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
24
26{
27public:
30 const QColor &color = QColor());
32
33 void createTextureData(int width, int height) override;
34 void resizeTextureData(int width, int height) override;
35 void beginFillTexture() override;
36 void fillTexture(const Coord &c, glyph_t glyph, const QFixedPoint &subPixelPosition) override;
37 void endFillTexture() override;
38 int glyphPadding() const override;
39 int maxTextureWidth() const override;
40 int maxTextureHeight() const override;
41
42 QRhiTexture *texture() const { return m_texture; }
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
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
66
67#endif // QSGRHITEXTUREGLYPHCACHE_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
\inmodule QtGui
Definition qrhi.h:1731
\inmodule QtGui
Definition qrhi.h:895
Format
Specifies the texture format.
Definition qrhi.h:914
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
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
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLint GLsizei GLsizei height
GLint GLsizei width
GLuint color
[2]
GLint GLsizei GLsizei GLenum format
const GLubyte * c
GLint void * img
Definition qopenglext.h:233
GLuint GLenum matrix
unsigned int glyph_t