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
qsgdistancefieldglyphnode_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QSGDISTANCEFIELDGLYPHNODE_P_H
5#define QSGDISTANCEFIELDGLYPHNODE_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 <private/qsgadaptationlayer_p.h>
19#include <QtQuick/qsgtexture.h>
20
21#include <QtQuick/private/qquicktext_p.h>
22
24
26
27class QSGRenderContext;
28class QSGDistanceFieldTextMaterial;
29
31{
32public:
33 QSGDistanceFieldGlyphNode(QSGRenderContext *context);
35
36 QPointF baseLine() const override { return m_baseLine; }
37 void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override;
38 void setColor(const QColor &color) override;
39
40 void setPreferredAntialiasingMode(AntialiasingMode mode) override;
41 void setRenderTypeQuality(int renderTypeQuality) override;
42
43 void setStyle(QQuickText::TextStyle style) override;
44 void setStyleColor(const QColor &color) override;
45
46 void update() override;
47 void preprocess() override;
48
49 void invalidateGlyphs(const QVector<quint32> &glyphs) override;
50
51 void updateGeometry();
52
53private:
54 enum DistanceFieldGlyphNodeType {
55 RootGlyphNode,
56 SubGlyphNode
57 };
58
59 void setGlyphNodeType(DistanceFieldGlyphNodeType type) { m_glyphNodeType = type; }
60 void updateMaterial();
61
62 DistanceFieldGlyphNodeType m_glyphNodeType;
63 QColor m_color;
64 QPointF m_baseLine;
65 QSGRenderContext *m_context;
66 QSGDistanceFieldTextMaterial *m_material;
67 QPointF m_originalPosition;
68 QPointF m_position;
69 QGlyphRun m_glyphs;
70 QSGDistanceFieldGlyphCache *m_glyph_cache;
71 QSGGeometry m_geometry;
72 QQuickText::TextStyle m_style;
73 QColor m_styleColor;
74 AntialiasingMode m_antialiasingMode;
75 QRectF m_boundingRect;
76 const QSGDistanceFieldGlyphCache::Texture *m_texture;
77 int m_renderTypeQuality;
78
79 struct GlyphInfo {
80 QVector<quint32> indexes;
81 QVector<QPointF> positions;
82 };
83 QSet<quint32> m_allGlyphIndexesLookup;
84 // m_glyphs holds pointers to the GlyphInfo.indexes and positions arrays, so we need to hold on to them
85 QHash<const QSGDistanceFieldGlyphCache::Texture *, GlyphInfo> m_glyphsInOtherTextures;
86
87 uint m_dirtyGeometry: 1;
88 uint m_dirtyMaterial: 1;
89};
90
91QT_END_NAMESPACE
92
93#endif
QSGDistanceFieldGlyphNode(QSGRenderContext *context)
void setStyleColor(const QColor &color) override
void setStyle(QQuickText::TextStyle style) override
void setRenderTypeQuality(int renderTypeQuality) override
void setColor(const QColor &color) override
void setPreferredAntialiasingMode(AntialiasingMode mode) override
void preprocess() override
Override this function to do processing on the node before it is rendered.
void invalidateGlyphs(const QVector< quint32 > &glyphs) override
void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) override
QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcEventDispatcher)