Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | - | |||||||
2 | - | |||||||
3 | - | |||||||
4 | QSGSoftwareRectangleNode::QSGSoftwareRectangleNode() | - | ||||||
5 | : m_color(QColor(255, 255, 255)) | - | ||||||
6 | { | - | ||||||
7 | setMaterial((QSGMaterial*)1); | - | ||||||
8 | setGeometry((QSGGeometry*)1); | - | ||||||
9 | } never executed: end of block | 0 | ||||||
10 | - | |||||||
11 | void QSGSoftwareRectangleNode::paint(QPainter *painter) | - | ||||||
12 | { | - | ||||||
13 | painter->fillRect(m_rect, m_color); | - | ||||||
14 | } never executed: end of block | 0 | ||||||
15 | - | |||||||
16 | QSGSoftwareImageNode::QSGSoftwareImageNode() | - | ||||||
17 | : m_texture(nullptr), | - | ||||||
18 | m_owns(false), | - | ||||||
19 | m_filtering(QSGTexture::None), | - | ||||||
20 | m_transformMode(NoTransform), | - | ||||||
21 | m_cachedMirroredPixmapIsDirty(false) | - | ||||||
22 | { | - | ||||||
23 | setMaterial((QSGMaterial*)1); | - | ||||||
24 | setGeometry((QSGGeometry*)1); | - | ||||||
25 | } never executed: end of block | 0 | ||||||
26 | - | |||||||
27 | QSGSoftwareImageNode::~QSGSoftwareImageNode() | - | ||||||
28 | { | - | ||||||
29 | if (m_owns
| 0 | ||||||
30 | delete m_texture; never executed: delete m_texture; | 0 | ||||||
31 | } never executed: end of block | 0 | ||||||
32 | - | |||||||
33 | void QSGSoftwareImageNode::setTexture(QSGTexture *texture) | - | ||||||
34 | { | - | ||||||
35 | if (m_owns
| 0 | ||||||
36 | delete m_texture; never executed: delete m_texture; | 0 | ||||||
37 | - | |||||||
38 | m_texture = texture; markDirty(DirtyMaterial); | - | ||||||
39 | m_cachedMirroredPixmapIsDirty = true; | - | ||||||
40 | } never executed: end of block | 0 | ||||||
41 | - | |||||||
42 | void QSGSoftwareImageNode::setTextureCoordinatesTransform(QSGImageNode::TextureCoordinatesTransformMode transformNode) | - | ||||||
43 | { | - | ||||||
44 | if (m_transformMode == transformNode
| 0 | ||||||
45 | return; never executed: return; | 0 | ||||||
46 | - | |||||||
47 | m_transformMode = transformNode; | - | ||||||
48 | m_cachedMirroredPixmapIsDirty = true; | - | ||||||
49 | - | |||||||
50 | markDirty(DirtyGeometry); | - | ||||||
51 | } never executed: end of block | 0 | ||||||
52 | - | |||||||
53 | void QSGSoftwareImageNode::paint(QPainter *painter) | - | ||||||
54 | { | - | ||||||
55 | if (m_cachedMirroredPixmapIsDirty
| 0 | ||||||
56 | updateCachedMirroredPixmap(); never executed: updateCachedMirroredPixmap(); | 0 | ||||||
57 | - | |||||||
58 | painter->setRenderHint(QPainter::SmoothPixmapTransform, (m_filtering == QSGTexture::Linear)); | - | ||||||
59 | - | |||||||
60 | if (!m_cachedPixmap.isNull()
| 0 | ||||||
61 | painter->drawPixmap(m_rect, m_cachedPixmap, m_sourceRect); | - | ||||||
62 | } never executed: else if (QSGSoftwarePixmapTexture *pt = qobject_cast<QSGSoftwarePixmapTexture *>(m_texture)end of block
| 0 | ||||||
63 | const QPixmap &pm = pt->pixmap(); | - | ||||||
64 | painter->drawPixmap(m_rect, pm, m_sourceRect); | - | ||||||
65 | } never executed: else if (QSGPlainTexture *pt = qobject_cast<QSGPlainTexture *>(m_texture)end of block
| 0 | ||||||
66 | const QImage &im = pt->image(); | - | ||||||
67 | painter->drawImage(m_rect, im, m_sourceRect); | - | ||||||
68 | } never executed: end of block | 0 | ||||||
69 | } never executed: end of block | 0 | ||||||
70 | - | |||||||
71 | void QSGSoftwareImageNode::updateCachedMirroredPixmap() | - | ||||||
72 | { | - | ||||||
73 | if (m_transformMode == NoTransform
| 0 | ||||||
74 | m_cachedPixmap = QPixmap(); | - | ||||||
75 | } never executed: else {end of block | 0 | ||||||
76 | - | |||||||
77 | if (QSGSoftwarePixmapTexture *pt = qobject_cast<QSGSoftwarePixmapTexture *>(m_texture)
| 0 | ||||||
78 | QTransform mirrorTransform; | - | ||||||
79 | if (m_transformMode.testFlag(MirrorVertically)
| 0 | ||||||
80 | mirrorTransform = mirrorTransform.scale(1, -1); never executed: mirrorTransform = mirrorTransform.scale(1, -1); | 0 | ||||||
81 | if (m_transformMode.testFlag(MirrorHorizontally)
| 0 | ||||||
82 | mirrorTransform = mirrorTransform.scale(-1, 1); never executed: mirrorTransform = mirrorTransform.scale(-1, 1); | 0 | ||||||
83 | m_cachedPixmap = pt->pixmap().transformed(mirrorTransform); | - | ||||||
84 | } never executed: else if (QSGPlainTexture *pt = qobject_cast<QSGPlainTexture *>(m_texture)end of block
| 0 | ||||||
85 | m_cachedPixmap = QPixmap::fromImage(pt->image().mirrored(m_transformMode.testFlag(MirrorHorizontally), m_transformMode.testFlag(MirrorVertically))); | - | ||||||
86 | } never executed: else {end of block | 0 | ||||||
87 | m_cachedPixmap = QPixmap(); | - | ||||||
88 | } never executed: end of block | 0 | ||||||
89 | } | - | ||||||
90 | - | |||||||
91 | m_cachedMirroredPixmapIsDirty = false; | - | ||||||
92 | } never executed: end of block | 0 | ||||||
93 | - | |||||||
94 | QSGSoftwareNinePatchNode::QSGSoftwareNinePatchNode() | - | ||||||
95 | { | - | ||||||
96 | setMaterial((QSGMaterial*)1); | - | ||||||
97 | setGeometry((QSGGeometry*)1); | - | ||||||
98 | } never executed: end of block | 0 | ||||||
99 | - | |||||||
100 | void QSGSoftwareNinePatchNode::setTexture(QSGTexture *texture) | - | ||||||
101 | { | - | ||||||
102 | QSGSoftwarePixmapTexture *pt = qobject_cast<QSGSoftwarePixmapTexture*>(texture); | - | ||||||
103 | if (!pt
| 0 | ||||||
104 | QMessageLogger(__FILE__, 146, __PRETTY_FUNCTION__).warning() << "Image used with invalid texture format."; | - | ||||||
105 | return; never executed: return; | 0 | ||||||
106 | } | - | ||||||
107 | m_pixmap = pt->pixmap(); | - | ||||||
108 | markDirty(DirtyMaterial); | - | ||||||
109 | } never executed: end of block | 0 | ||||||
110 | - | |||||||
111 | void QSGSoftwareNinePatchNode::setBounds(const QRectF &bounds) | - | ||||||
112 | { | - | ||||||
113 | if (m_bounds == bounds
| 0 | ||||||
114 | return; never executed: return; | 0 | ||||||
115 | - | |||||||
116 | m_bounds = bounds; | - | ||||||
117 | markDirty(DirtyGeometry); | - | ||||||
118 | } never executed: end of block | 0 | ||||||
119 | - | |||||||
120 | void QSGSoftwareNinePatchNode::setDevicePixelRatio(qreal ratio) | - | ||||||
121 | { | - | ||||||
122 | if (m_pixelRatio == ratio
| 0 | ||||||
123 | return; never executed: return; | 0 | ||||||
124 | - | |||||||
125 | m_pixelRatio = ratio; | - | ||||||
126 | markDirty(DirtyGeometry); | - | ||||||
127 | } never executed: end of block | 0 | ||||||
128 | - | |||||||
129 | void QSGSoftwareNinePatchNode::setPadding(qreal left, qreal top, qreal right, qreal bottom) | - | ||||||
130 | { | - | ||||||
131 | QMargins margins(qRound(left), qRound(top), qRound(right), qRound(bottom)); | - | ||||||
132 | if (m_margins == margins
| 0 | ||||||
133 | return; never executed: return; | 0 | ||||||
134 | - | |||||||
135 | m_margins = QMargins(qRound(left), qRound(top), qRound(right), qRound(bottom)); | - | ||||||
136 | markDirty(DirtyGeometry); | - | ||||||
137 | } never executed: end of block | 0 | ||||||
138 | - | |||||||
139 | void QSGSoftwareNinePatchNode::update() | - | ||||||
140 | { | - | ||||||
141 | } | - | ||||||
142 | - | |||||||
143 | void QSGSoftwareNinePatchNode::paint(QPainter *painter) | - | ||||||
144 | { | - | ||||||
145 | if (m_margins.isNull()
| 0 | ||||||
146 | painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height())); never executed: painter->drawPixmap(m_bounds, m_pixmap, QRectF(0, 0, m_pixmap.width(), m_pixmap.height())); | 0 | ||||||
147 | else | - | ||||||
148 | QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()), never executed: QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()), m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr)); | 0 | ||||||
149 | m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr)); never executed: QSGSoftwareHelpers::qDrawBorderPixmap(painter, m_bounds.toRect(), m_margins, m_pixmap, QRect(0, 0, m_pixmap.width(), m_pixmap.height()), m_margins, Qt::StretchTile, QSGSoftwareHelpers::QDrawBorderPixmap::DrawingHints(nullptr)); | 0 | ||||||
150 | } | - | ||||||
151 | - | |||||||
152 | QRectF QSGSoftwareNinePatchNode::bounds() const | - | ||||||
153 | { | - | ||||||
154 | return never executed: m_bounds;return m_bounds; never executed: return m_bounds; | 0 | ||||||
155 | } | - | ||||||
156 | - | |||||||
157 | - | |||||||
Switch to Source code | Preprocessed file |