tools/qsize.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3void QSize::transpose() -
4{ -
5 int tmp = wd; -
6 wd = ht; -
7 ht = tmp; -
8}
executed: }
Execution Count:3
3
9QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const -
10{ -
11 if (mode == Qt::IgnoreAspectRatio || wd == 0 || ht == 0) {
evaluated: mode == Qt::IgnoreAspectRatio
TRUEFALSE
yes
Evaluation Count:412
yes
Evaluation Count:2892
evaluated: wd == 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2890
partially evaluated: ht == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2890
0-2892
12 return s;
executed: return s;
Execution Count:414
414
13 } else { -
14 bool useHeight; -
15 qint64 rw = qint64(s.ht) * qint64(wd) / qint64(ht); -
16 -
17 if (mode == Qt::KeepAspectRatio) {
evaluated: mode == Qt::KeepAspectRatio
TRUEFALSE
yes
Evaluation Count:2888
yes
Evaluation Count:2
2-2888
18 useHeight = (rw <= s.wd); -
19 } else {
executed: }
Execution Count:2888
2888
20 useHeight = (rw >= s.wd); -
21 }
executed: }
Execution Count:2
2
22 -
23 if (useHeight) {
evaluated: useHeight
TRUEFALSE
yes
Evaluation Count:2852
yes
Evaluation Count:38
38-2852
24 return QSize(rw, s.ht);
executed: return QSize(rw, s.ht);
Execution Count:2852
2852
25 } else { -
26 return QSize(s.wd, 38
27 qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
executed: return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
Execution Count:38
38
28 } -
29 } -
30} -
31QDataStream &operator<<(QDataStream &s, const QSize &sz) -
32{ -
33 if (s.version() == 1)
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:92
0-92
34 s << (qint16)sz.width() << (qint16)sz.height();
never executed: s << (qint16)sz.width() << (qint16)sz.height();
0
35 else -
36 s << (qint32)sz.width() << (qint32)sz.height();
executed: s << (qint32)sz.width() << (qint32)sz.height();
Execution Count:92
92
37 return s;
executed: return s;
Execution Count:92
92
38} -
39QDataStream &operator>>(QDataStream &s, QSize &sz) -
40{ -
41 if (s.version() == 1) {
partially evaluated: s.version() == 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:100
0-100
42 qint16 w, h; -
43 s >> w; sz.rwidth() = w; -
44 s >> h; sz.rheight() = h; -
45 }
never executed: }
0
46 else { -
47 qint32 w, h; -
48 s >> w; sz.rwidth() = w; -
49 s >> h; sz.rheight() = h; -
50 }
executed: }
Execution Count:100
100
51 return s;
executed: return s;
Execution Count:100
100
52} -
53 -
54 -
55 -
56QDebug operator<<(QDebug dbg, const QSize &s) { -
57 dbg.nospace() << "QSize(" << s.width() << ", " << s.height() << ')'; -
58 return dbg.space();
executed: return dbg.space();
Execution Count:4
4
59} -
60void QSizeF::transpose() -
61{ -
62 qreal tmp = wd; -
63 wd = ht; -
64 ht = tmp; -
65}
executed: }
Execution Count:6
6
66QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const -
67{ -
68 if (mode == Qt::IgnoreAspectRatio || qIsNull(wd) || qIsNull(ht)) {
evaluated: mode == Qt::IgnoreAspectRatio
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:6
evaluated: qIsNull(wd)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
partially evaluated: qIsNull(ht)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-6
69 return s;
executed: return s;
Execution Count:4
4
70 } else { -
71 bool useHeight; -
72 qreal rw = s.ht * wd / ht; -
73 -
74 if (mode == Qt::KeepAspectRatio) {
evaluated: mode == Qt::KeepAspectRatio
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
75 useHeight = (rw <= s.wd); -
76 } else {
executed: }
Execution Count:2
2
77 useHeight = (rw >= s.wd); -
78 }
executed: }
Execution Count:2
2
79 -
80 if (useHeight) {
evaluated: useHeight
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
81 return QSizeF(rw, s.ht);
executed: return QSizeF(rw, s.ht);
Execution Count:2
2
82 } else { -
83 return QSizeF(s.wd, s.wd * ht / wd);
executed: return QSizeF(s.wd, s.wd * ht / wd);
Execution Count:2
2
84 } -
85 } -
86} -
87QDataStream &operator<<(QDataStream &s, const QSizeF &sz) -
88{ -
89 s << double(sz.width()) << double(sz.height()); -
90 return s;
executed: return s;
Execution Count:69
69
91} -
92QDataStream &operator>>(QDataStream &s, QSizeF &sz) -
93{ -
94 double w, h; -
95 s >> w; -
96 s >> h; -
97 sz.setWidth(qreal(w)); -
98 sz.setHeight(qreal(h)); -
99 return s;
executed: return s;
Execution Count:73
73
100} -
101 -
102 -
103 -
104QDebug operator<<(QDebug dbg, const QSizeF &s) { -
105 dbg.nospace() << "QSizeF(" << s.width() << ", " << s.height() << ')'; -
106 return dbg.space();
executed: return dbg.space();
Execution Count:1
1
107} -
108 -
109 -
110 -
111 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial