Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwareglyphnode.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtQuick module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | - | |||||||
40 | #include "qsgsoftwareglyphnode_p.h" | - | ||||||
41 | - | |||||||
42 | QT_BEGIN_NAMESPACE | - | ||||||
43 | - | |||||||
44 | QSGSoftwareGlyphNode::QSGSoftwareGlyphNode() | - | ||||||
45 | : m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 0) | - | ||||||
46 | , m_style(QQuickText::Normal) | - | ||||||
47 | { | - | ||||||
48 | setMaterial((QSGMaterial*)1); | - | ||||||
49 | setGeometry(&m_geometry); | - | ||||||
50 | } never executed: end of block | 0 | ||||||
51 | - | |||||||
52 | - | |||||||
53 | void QSGSoftwareGlyphNode::setGlyphs(const QPointF &position, const QGlyphRun &glyphs) | - | ||||||
54 | { | - | ||||||
55 | m_position = position; | - | ||||||
56 | m_glyphRun = glyphs; | - | ||||||
57 | m_bounding_rect = glyphs.boundingRect().translated(m_position - QPointF(0.0, glyphs.rawFont().ascent())); | - | ||||||
58 | } never executed: end of block | 0 | ||||||
59 | - | |||||||
60 | void QSGSoftwareGlyphNode::setColor(const QColor &color) | - | ||||||
61 | { | - | ||||||
62 | m_color = color; | - | ||||||
63 | } never executed: end of block | 0 | ||||||
64 | - | |||||||
65 | void QSGSoftwareGlyphNode::setStyle(QQuickText::TextStyle style) | - | ||||||
66 | { | - | ||||||
67 | m_style = style; | - | ||||||
68 | } never executed: end of block | 0 | ||||||
69 | - | |||||||
70 | void QSGSoftwareGlyphNode::setStyleColor(const QColor &color) | - | ||||||
71 | { | - | ||||||
72 | m_styleColor = color; | - | ||||||
73 | } never executed: end of block | 0 | ||||||
74 | - | |||||||
75 | QPointF QSGSoftwareGlyphNode::baseLine() const | - | ||||||
76 | { | - | ||||||
77 | return QPointF(); never executed: return QPointF(); | 0 | ||||||
78 | } | - | ||||||
79 | - | |||||||
80 | void QSGSoftwareGlyphNode::setPreferredAntialiasingMode(QSGGlyphNode::AntialiasingMode) | - | ||||||
81 | { | - | ||||||
82 | } | - | ||||||
83 | - | |||||||
84 | void QSGSoftwareGlyphNode::update() | - | ||||||
85 | { | - | ||||||
86 | } | - | ||||||
87 | - | |||||||
88 | void QSGSoftwareGlyphNode::paint(QPainter *painter) | - | ||||||
89 | { | - | ||||||
90 | painter->setBrush(QBrush()); | - | ||||||
91 | QPointF pos = m_position - QPointF(0, m_glyphRun.rawFont().ascent()); | - | ||||||
92 | - | |||||||
93 | qreal offset = 1.0; | - | ||||||
94 | if (painter->device()->devicePixelRatio() != 0)
| 0 | ||||||
95 | offset = 1.0 / painter->device()->devicePixelRatio(); never executed: offset = 1.0 / painter->device()->devicePixelRatio(); | 0 | ||||||
96 | - | |||||||
97 | switch (m_style) { | - | ||||||
98 | case QQuickText::Normal: break; never executed: break; never executed: case QQuickText::Normal: | 0 | ||||||
99 | case QQuickText::Outline: never executed: case QQuickText::Outline: | 0 | ||||||
100 | painter->setPen(m_styleColor); | - | ||||||
101 | painter->drawGlyphRun(pos + QPointF(0, offset), m_glyphRun); | - | ||||||
102 | painter->drawGlyphRun(pos + QPointF(0, -offset), m_glyphRun); | - | ||||||
103 | painter->drawGlyphRun(pos + QPointF(offset, 0), m_glyphRun); | - | ||||||
104 | painter->drawGlyphRun(pos + QPointF(-offset, 0), m_glyphRun); | - | ||||||
105 | break; never executed: break; | 0 | ||||||
106 | case QQuickText::Raised: never executed: case QQuickText::Raised: | 0 | ||||||
107 | painter->setPen(m_styleColor); | - | ||||||
108 | painter->drawGlyphRun(pos + QPointF(0, offset), m_glyphRun); | - | ||||||
109 | break; never executed: break; | 0 | ||||||
110 | case QQuickText::Sunken: never executed: case QQuickText::Sunken: | 0 | ||||||
111 | painter->setPen(m_styleColor); | - | ||||||
112 | painter->drawGlyphRun(pos + QPointF(0, -offset), m_glyphRun); | - | ||||||
113 | break; never executed: break; | 0 | ||||||
114 | } | - | ||||||
115 | - | |||||||
116 | painter->setPen(m_color); | - | ||||||
117 | painter->drawGlyphRun(pos, m_glyphRun); | - | ||||||
118 | } never executed: end of block | 0 | ||||||
119 | - | |||||||
120 | QT_END_NAMESPACE | - | ||||||
Source code | Switch to Preprocessed file |