OpenCoverage

qsgsoftwarespritenode.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/quick/scenegraph/adaptations/software/qsgsoftwarespritenode.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
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 "qsgsoftwarespritenode_p.h"-
41#include "qsgsoftwarepixmaptexture_p.h"-
42#include <QtGui/QPainter>-
43-
44QT_BEGIN_NAMESPACE-
45-
46QSGSoftwareSpriteNode::QSGSoftwareSpriteNode()-
47{-
48 setMaterial((QSGMaterial*)1);-
49 setGeometry((QSGGeometry*)1);-
50}
never executed: end of block
0
51-
52void QSGSoftwareSpriteNode::setTexture(QSGTexture *texture)-
53{-
54 m_texture = qobject_cast<QSGSoftwarePixmapTexture*>(texture);-
55 markDirty(DirtyMaterial);-
56}
never executed: end of block
0
57-
58void QSGSoftwareSpriteNode::setTime(float time)-
59{-
60 if (m_time != time) {
m_time != timeDescription
TRUEnever evaluated
FALSEnever evaluated
0
61 m_time = time;-
62 markDirty(DirtyMaterial);-
63 }
never executed: end of block
0
64}
never executed: end of block
0
65-
66void QSGSoftwareSpriteNode::setSourceA(const QPoint &source)-
67{-
68 if (m_sourceA != source) {
m_sourceA != sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
69 m_sourceA = source;-
70 markDirty(DirtyMaterial);-
71 }
never executed: end of block
0
72}
never executed: end of block
0
73-
74void QSGSoftwareSpriteNode::setSourceB(const QPoint &source)-
75{-
76 if (m_sourceB != source) {
m_sourceB != sourceDescription
TRUEnever evaluated
FALSEnever evaluated
0
77 m_sourceB = source;-
78 markDirty(DirtyMaterial);-
79 }
never executed: end of block
0
80}
never executed: end of block
0
81-
82void QSGSoftwareSpriteNode::setSpriteSize(const QSize &size)-
83{-
84 if (m_spriteSize != size) {
m_spriteSize != sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
85 m_spriteSize = size;-
86 markDirty(DirtyMaterial);-
87 }
never executed: end of block
0
88}
never executed: end of block
0
89-
90void QSGSoftwareSpriteNode::setSheetSize(const QSize &size)-
91{-
92 if (m_sheetSize != size) {
m_sheetSize != sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
93 m_sheetSize = size;-
94 markDirty(DirtyMaterial);-
95 }
never executed: end of block
0
96}
never executed: end of block
0
97-
98void QSGSoftwareSpriteNode::setSize(const QSizeF &size)-
99{-
100 if (m_size != size) {
m_size != sizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
101 m_size = size;-
102 markDirty(DirtyGeometry);-
103 }
never executed: end of block
0
104}
never executed: end of block
0
105-
106void QSGSoftwareSpriteNode::setFiltering(QSGTexture::Filtering filtering)-
107{-
108 Q_UNUSED(filtering);-
109}
never executed: end of block
0
110-
111void QSGSoftwareSpriteNode::update()-
112{-
113}-
114-
115void QSGSoftwareSpriteNode::paint(QPainter *painter)-
116{-
117 //Get the pixmap handle from the texture-
118 if (!m_texture)
!m_textureDescription
TRUEnever evaluated
FALSEnever evaluated
0
119 return;
never executed: return;
0
120-
121 const QPixmap &pixmap = m_texture->pixmap();-
122-
123 // XXX try to do some kind of interpolation between sourceA and sourceB using time-
124 painter->drawPixmap(QRectF(0, 0, m_size.width(), m_size.height()),-
125 pixmap,-
126 QRectF(m_sourceA * pixmap.devicePixelRatioF(), m_spriteSize * pixmap.devicePixelRatioF()));-
127}
never executed: end of block
0
128-
129bool QSGSoftwareSpriteNode::isOpaque() const-
130{-
131 return false;
never executed: return false;
0
132}-
133-
134QRectF QSGSoftwareSpriteNode::rect() const-
135{-
136 return QRectF(0, 0, m_size.width(), m_size.height());
never executed: return QRectF(0, 0, m_size.width(), m_size.height());
0
137}-
138-
139QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0