OpenCoverage

qquickmaskextruder.cpp

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/particles/qquickmaskextruder.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2QQuickMaskExtruder::QQuickMaskExtruder(QObject *parent) :-
3 QQuickParticleExtruder(parent)-
4 , m_lastWidth(-1)-
5 , m_lastHeight(-1)-
6{-
7}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmaskextruder
14
8-
9void QQuickMaskExtruder::setSource(QUrl arg)-
10{-
11 if (m_source != arg
m_source != argDescription
TRUEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmaskextruder
FALSEnever evaluated
) {
0-14
12 m_source = arg;-
13-
14 m_lastHeight = -1;-
15 m_lastWidth = -1;-
16 sourceChanged(arg);-
17 startMaskLoading();-
18 }
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmaskextruder
14
19}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmaskextruder
14
20-
21void QQuickMaskExtruder::startMaskLoading()-
22{-
23 m_pix.clear(this);-
24 if (m_source.isEmpty()
m_source.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmaskextruder
)
0-14
25 return;
never executed: return;
0
26 m_pix.load(qmlEngine(this), m_source);-
27 if (m_pix.isLoading()
m_pix.isLoading()Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmaskextruder
)
0-14
28 m_pix.connectFinished(this, qFlagLocation("1""finishMaskLoading()" "\0" __FILE__ ":" "90"));
never executed: m_pix.connectFinished(this, qFlagLocation("1""finishMaskLoading()" "\0" __FILE__ ":" "90"));
0
29 else-
30 finishMaskLoading();
executed 14 times by 2 tests: finishMaskLoading();
Executed by:
  • tst_examples
  • tst_qquickmaskextruder
14
31}-
32-
33void QQuickMaskExtruder::finishMaskLoading()-
34{-
35 if (m_pix.isError()
m_pix.isError()Description
TRUEnever evaluated
FALSEevaluated 14 times by 2 tests
Evaluated by:
  • tst_examples
  • tst_qquickmaskextruder
)
0-14
36 qmlWarning(this) << m_pix.error();
never executed: qmlWarning(this) << m_pix.error();
0
37}
executed 14 times by 2 tests: end of block
Executed by:
  • tst_examples
  • tst_qquickmaskextruder
14
38-
39QPointF QQuickMaskExtruder::extrude(const QRectF &r)-
40{-
41 ensureInitialized(r);-
42 if (!m_mask.count()
!m_mask.count()Description
TRUEnever evaluated
FALSEevaluated 1216 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
|| m_img.isNull()
m_img.isNull()Description
TRUEnever evaluated
FALSEevaluated 1216 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
)
0-1216
43 return
never executed: return r.topLeft();
r.topLeft();
never executed: return r.topLeft();
0
44 const QPointF p = m_mask[QRandomGenerator::global()->bounded(m_mask.count())];-
45-
46 return
executed 1216 times by 1 test: return p + r.topLeft();
Executed by:
  • tst_qquickmaskextruder
p + r.topLeft();
executed 1216 times by 1 test: return p + r.topLeft();
Executed by:
  • tst_qquickmaskextruder
1216
47}-
48-
49bool QQuickMaskExtruder::contains(const QRectF &bounds, const QPointF &point)-
50{-
51 ensureInitialized(bounds);-
52 if (m_img.isNull()
m_img.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
53 return
never executed: return false;
false;
never executed: return false;
0
54-
55 QPointF pt = point - bounds.topLeft();-
56 QPoint p(pt.x() * m_img.width() / bounds.width(),-
57 pt.y() * m_img.height() / bounds.height());-
58 return
never executed: return m_img.rect().contains(p) && (m_img.pixel(p) & 0xff000000);
m_img.rect().contains(p) && (m_img.pixel(p) & 0xff000000);
never executed: return m_img.rect().contains(p) && (m_img.pixel(p) & 0xff000000);
0
59}-
60-
61void QQuickMaskExtruder::ensureInitialized(const QRectF &rf)-
62{-
63-
64-
65 QRect r = rf.toRect();-
66 if (m_lastWidth == r.width()
m_lastWidth == r.width()Description
TRUEevaluated 1214 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
&& m_lastHeight == r.height()
m_lastHeight == r.height()Description
TRUEevaluated 1214 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEnever evaluated
)
0-1214
67 return;
executed 1214 times by 1 test: return;
Executed by:
  • tst_qquickmaskextruder
1214
68 if (!m_pix.isReady()
!m_pix.isReady()Description
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
)
0-2
69 return;
never executed: return;
0
70 m_lastWidth = r.width();-
71 m_lastHeight = r.height();-
72-
73 m_mask.clear();-
74-
75 m_img = m_pix.image();-
76-
77-
78 if (m_img.format() != QImage::Format_ARGB32
m_img.format()...:Format_ARGB32Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEnever evaluated
&& m_img.format() != QImage::Format_ARGB32_Premultiplied
m_img.format()..._PremultipliedDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
)
0-2
79 m_img = m_img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
never executed: m_img = m_img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
0
80-
81-
82 int sx = (m_img.width() << 16) / r.width();-
83 int sy = (m_img.height() << 16) / r.height();-
84 int w = r.width();-
85 int h = r.height();-
86 for (int y=0; y<h
y<hDescription
TRUEevaluated 640 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
; ++y) {
2-640
87 const uint *sl = (const uint *) m_img.constScanLine((y * sy) >> 16);-
88 for (int x=0; x<w
x<wDescription
TRUEevaluated 204800 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEevaluated 640 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
; ++x) {
640-204800
89 if (sl[(x * sx) >> 16] & 0xff000000
sl[(x * sx) >>...] & 0xff000000Description
TRUEevaluated 20402 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
FALSEevaluated 184398 times by 1 test
Evaluated by:
  • tst_qquickmaskextruder
)
20402-184398
90 m_mask << QPointF(x, y);
executed 20402 times by 1 test: m_mask << QPointF(x, y);
Executed by:
  • tst_qquickmaskextruder
20402
91 }
executed 204800 times by 1 test: end of block
Executed by:
  • tst_qquickmaskextruder
204800
92 }
executed 640 times by 1 test: end of block
Executed by:
  • tst_qquickmaskextruder
640
93}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qquickmaskextruder
2
94-
95-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.2.0