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#include "qsgbasicglyphnode_p.h"
5#include <qsgmaterial.h> // just so that we can safely do delete m_material in the dtor
6
7QT_BEGIN_NAMESPACE
8
9QSGBasicGlyphNode::QSGBasicGlyphNode()
10 : m_style(QQuickText::Normal)
11 , m_material(nullptr)
12 , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0)
13{
14 m_geometry.setDrawingMode(QSGGeometry::DrawTriangles);
15 setGeometry(&m_geometry);
16}
17
18QSGBasicGlyphNode::~QSGBasicGlyphNode()
19{
20 delete m_material;
21}
22
23void QSGBasicGlyphNode::setColor(const QColor &color)
24{
25 m_color = color;
26 if (m_material != nullptr) {
27 setMaterialColor(color);
28 markDirty(bits: DirtyMaterial);
29 }
30}
31
32void QSGBasicGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs)
33{
34 if (m_material != nullptr)
35 delete m_material;
36
37 m_position = position;
38 m_glyphs = glyphs;
39
40#ifdef QSG_RUNTIME_DESCRIPTION
41 qsgnode_set_description(node: this, description: QLatin1String("glyphs"));
42#endif
43}
44
45void QSGBasicGlyphNode::setStyle(QQuickText::TextStyle style)
46{
47 if (m_style == style)
48 return;
49 m_style = style;
50}
51
52void QSGBasicGlyphNode::setStyleColor(const QColor &color)
53{
54 if (m_styleColor == color)
55 return;
56 m_styleColor = color;
57}
58
59QT_END_NAMESPACE
60

source code of qtdeclarative/src/quick/scenegraph/qsgbasicglyphnode.cpp