painting/qcolor.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3 -
4 -
5QColor::QColor(Qt::GlobalColor color) -
6{ -
7 -
8 -
9 -
10 -
11 -
12 static const QRgb global_colors[] = { -
13 QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), -
14 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), -
15 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), -
16 QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), -
17 QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((128 & 0xff) << 8) | (128 & 0xff))), -
18 QRgb(((0xffu << 24) | ((160 & 0xff) << 16) | ((160 & 0xff) << 8) | (164 & 0xff))), -
19 QRgb(((0xffu << 24) | ((192 & 0xff) << 16) | ((192 & 0xff) << 8) | (192 & 0xff))), -
20 QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), -
21 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((255 & 0xff) << 8) | (0 & 0xff))), -
22 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (255 & 0xff))), -
23 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((255 & 0xff) << 8) | (255 & 0xff))), -
24 QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((0 & 0xff) << 8) | (255 & 0xff))), -
25 QRgb(((0xffu << 24) | ((255 & 0xff) << 16) | ((255 & 0xff) << 8) | (0 & 0xff))), -
26 QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff))), -
27 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((128 & 0xff) << 8) | (0 & 0xff))), -
28 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (128 & 0xff))), -
29 QRgb(((0xffu << 24) | ((0 & 0xff) << 16) | ((128 & 0xff) << 8) | (128 & 0xff))), -
30 QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((0 & 0xff) << 8) | (128 & 0xff))), -
31 QRgb(((0xffu << 24) | ((128 & 0xff) << 16) | ((128 & 0xff) << 8) | (0 & 0xff))), -
32 QRgb(((0 & 0xff) << 24) | ((0 & 0xff) << 16) | ((0 & 0xff) << 8) | (0 & 0xff)) -
33 }; -
34 -
35 -
36 -
37 setRgb(qRed(global_colors[color]), -
38 qGreen(global_colors[color]), -
39 qBlue(global_colors[color]), -
40 qAlpha(global_colors[color])); -
41}
executed: }
Execution Count:3790070
3790070
42QColor::QColor(QRgb color) -
43{ -
44 cspec = Rgb; -
45 ct.argb.alpha = 0xffff; -
46 ct.argb.red = qRed(color) * 0x101; -
47 ct.argb.green = qGreen(color) * 0x101; -
48 ct.argb.blue = qBlue(color) * 0x101; -
49 ct.argb.pad = 0; -
50}
executed: }
Execution Count:826680
826680
51QColor::QColor(Spec spec) -
52{ -
53 switch (spec) { -
54 case Invalid: -
55 invalidate(); -
56 break;
executed: break;
Execution Count:1
1
57 case Rgb: -
58 setRgb(0, 0, 0); -
59 break;
executed: break;
Execution Count:1
1
60 case Hsv: -
61 setHsv(0, 0, 0); -
62 break;
executed: break;
Execution Count:1
1
63 case Cmyk: -
64 setCmyk(0, 0, 0, 0); -
65 break;
executed: break;
Execution Count:1
1
66 case Hsl: -
67 setHsl(0, 0, 0, 0); -
68 break;
never executed: break;
0
69 } -
70}
executed: }
Execution Count:4
4
71QString QColor::name() const -
72{ -
73 QString s; -
74 s.sprintf("#%02x%02x%02x", red(), green(), blue()); -
75 return s;
executed: return s;
Execution Count:47
47
76} -
77void QColor::setNamedColor(const QString &name) -
78{ -
79 setColorFromString(name); -
80}
executed: }
Execution Count:296
296
81bool QColor::isValidColor(const QString &name) -
82{ -
83 return !name.isEmpty() && QColor().setColorFromString(name);
never executed: return !name.isEmpty() && QColor().setColorFromString(name);
0
84} -
85 -
86bool QColor::setColorFromString(const QString &name) -
87{ -
88 if (name.isEmpty()) {
evaluated: name.isEmpty()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:295
1-295
89 invalidate(); -
90 return true;
executed: return true;
Execution Count:1
1
91 } -
92 -
93 if (name.startsWith(QLatin1Char('#'))) {
evaluated: name.startsWith(QLatin1Char('#'))
TRUEFALSE
yes
Evaluation Count:46
yes
Evaluation Count:249
46-249
94 QRgb rgb; -
95 if (qt_get_hex_rgb(name.constData(), name.length(), &rgb)) {
evaluated: qt_get_hex_rgb(name.constData(), name.length(), &rgb)
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:3
3-43
96 setRgb(rgb); -
97 return true;
executed: return true;
Execution Count:43
43
98 } else { -
99 invalidate(); -
100 return false;
executed: return false;
Execution Count:3
3
101 } -
102 } -
103 -
104 -
105 QRgb rgb; -
106 if (qt_get_named_rgb(name.constData(), name.length(), &rgb)) {
evaluated: qt_get_named_rgb(name.constData(), name.length(), &rgb)
TRUEFALSE
yes
Evaluation Count:248
yes
Evaluation Count:1
1-248
107 setRgba(rgb); -
108 return true;
executed: return true;
Execution Count:248
248
109 } else -
110 -
111 { -
112 invalidate(); -
113 return false;
executed: return false;
Execution Count:1
1
114 } -
115} -
116 -
117 -
118 -
119 -
120 -
121 -
122QStringList QColor::colorNames() -
123{ -
124 -
125 return qt_get_colornames();
executed: return qt_get_colornames();
Execution Count:1
1
126 -
127 -
128 -
129} -
130void QColor::getHsvF(qreal *h, qreal *s, qreal *v, qreal *a) const -
131{ -
132 if (!h || !s || !v)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !v
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
133 return;
never executed: return;
0
134 -
135 if (cspec != Invalid && cspec != Hsv) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
136 toHsv().getHsvF(h, s, v, a); -
137 return;
never executed: return;
0
138 } -
139 -
140 *h = ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
partially evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
141 *s = ct.ahsv.saturation / qreal((32767 * 2 + 1)); -
142 *v = ct.ahsv.value / qreal((32767 * 2 + 1)); -
143 -
144 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
0-232608
145 *a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
executed: *a = ct.ahsv.alpha / qreal((32767 * 2 + 1));
Execution Count:232608
232608
146}
executed: }
Execution Count:232608
232608
147void QColor::getHsv(int *h, int *s, int *v, int *a) const -
148{ -
149 if (!h || !s || !v)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
partially evaluated: !v
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:366268
0-366268
150 return;
never executed: return;
0
151 -
152 if (cspec != Invalid && cspec != Hsv) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:366268
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:66830
yes
Evaluation Count:299438
0-366268
153 toHsv().getHsv(h, s, v, a); -
154 return;
executed: return;
Execution Count:66830
66830
155 } -
156 -
157 *h = ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;
evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
yes
Evaluation Count:66794
yes
Evaluation Count:232644
66794-232644
158 *s = ct.ahsv.saturation >> 8; -
159 *v = ct.ahsv.value >> 8; -
160 -
161 if (a)
evaluated: a
TRUEFALSE
yes
Evaluation Count:298144
yes
Evaluation Count:1294
1294-298144
162 *a = ct.ahsv.alpha >> 8;
executed: *a = ct.ahsv.alpha >> 8;
Execution Count:298144
298144
163}
executed: }
Execution Count:299438
299438
164void QColor::setHsvF(qreal h, qreal s, qreal v, qreal a) -
165{ -
166 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
partially evaluated: h < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
never evaluated: h != qreal(-1.0)
0-232608
167 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
168 || (v < qreal(0.0) || v > qreal(1.0))
partially evaluated: v < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: v > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
169 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
170 QMessageLogger("painting/qcolor.cpp", 655, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range"); -
171 return;
never executed: return;
0
172 } -
173 -
174 cspec = Hsv; -
175 ct.ahsv.alpha = qRound(a * (32767 * 2 + 1)); -
176 ct.ahsv.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000);
partially evaluated: h == qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
177 ct.ahsv.saturation = qRound(s * (32767 * 2 + 1)); -
178 ct.ahsv.value = qRound(v * (32767 * 2 + 1)); -
179 ct.ahsv.pad = 0; -
180}
executed: }
Execution Count:232608
232608
181void QColor::setHsv(int h, int s, int v, int a) -
182{ -
183 if (h < -1 || (uint)s > 255 || (uint)v > 255 || (uint)a > 255) {
partially evaluated: h < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)v > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:326675
0-326675
184 QMessageLogger("painting/qcolor.cpp", 679, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range"); -
185 invalidate(); -
186 return;
never executed: return;
0
187 } -
188 -
189 cspec = Hsv; -
190 ct.ahsv.alpha = a * 0x101; -
191 ct.ahsv.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100;
evaluated: h == -1
TRUEFALSE
yes
Evaluation Count:5200
yes
Evaluation Count:321475
5200-321475
192 ct.ahsv.saturation = s * 0x101; -
193 ct.ahsv.value = v * 0x101; -
194 ct.ahsv.pad = 0; -
195}
executed: }
Execution Count:326675
326675
196void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const -
197{ -
198 if (!h || !s || !l)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
199 return;
never executed: return;
0
200 -
201 if (cspec != Invalid && cspec != Hsl) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
202 toHsl().getHslF(h, s, l, a); -
203 return;
never executed: return;
0
204 } -
205 -
206 *h = ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
207 *s = ct.ahsl.saturation / qreal((32767 * 2 + 1)); -
208 *l = ct.ahsl.lightness / qreal((32767 * 2 + 1)); -
209 -
210 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:232608
no
Evaluation Count:0
0-232608
211 *a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
executed: *a = ct.ahsl.alpha / qreal((32767 * 2 + 1));
Execution Count:232608
232608
212}
executed: }
Execution Count:232608
232608
213void QColor::getHsl(int *h, int *s, int *l, int *a) const -
214{ -
215 if (!h || !s || !l)
partially evaluated: !h
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
partially evaluated: !s
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
partially evaluated: !l
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
216 return;
never executed: return;
0
217 -
218 if (cspec != Invalid && cspec != Hsl) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:167072
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
219 toHsl().getHsl(h, s, l, a); -
220 return;
never executed: return;
0
221 } -
222 -
223 *h = ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:167072
0-167072
224 *s = ct.ahsl.saturation >> 8; -
225 *l = ct.ahsl.lightness >> 8; -
226 -
227 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:167072
no
Evaluation Count:0
0-167072
228 *a = ct.ahsl.alpha >> 8;
executed: *a = ct.ahsl.alpha >> 8;
Execution Count:167072
167072
229}
executed: }
Execution Count:167072
167072
230void QColor::setHslF(qreal h, qreal s, qreal l, qreal a) -
231{ -
232 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
partially evaluated: h < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
never evaluated: h != qreal(-1.0)
0-232608
233 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
234 || (l < qreal(0.0) || l > qreal(1.0))
partially evaluated: l < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: l > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
235 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
236 QMessageLogger("painting/qcolor.cpp", 768, __PRETTY_FUNCTION__).warning("QColor::setHsvF: HSV parameters out of range"); -
237 return;
never executed: return;
0
238 } -
239 -
240 cspec = Hsl; -
241 ct.ahsl.alpha = qRound(a * (32767 * 2 + 1)); -
242 ct.ahsl.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000);
partially evaluated: h == qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
243 ct.ahsl.saturation = qRound(s * (32767 * 2 + 1)); -
244 ct.ahsl.lightness = qRound(l * (32767 * 2 + 1)); -
245 ct.ahsl.pad = 0; -
246}
executed: }
Execution Count:232608
232608
247void QColor::setHsl(int h, int s, int l, int a) -
248{ -
249 if (h < -1 || (uint)s > 255 || (uint)l > 255 || (uint)a > 255) {
partially evaluated: h < -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)l > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
250 QMessageLogger("painting/qcolor.cpp", 794, __PRETTY_FUNCTION__).warning("QColor::setHsv: HSV parameters out of range"); -
251 invalidate(); -
252 return;
never executed: return;
0
253 } -
254 -
255 cspec = Hsl; -
256 ct.ahsl.alpha = a * 0x101; -
257 ct.ahsl.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:232608
0-232608
258 ct.ahsl.saturation = s * 0x101; -
259 ct.ahsl.lightness = l * 0x101; -
260 ct.ahsl.pad = 0; -
261}
executed: }
Execution Count:232608
232608
262void QColor::getRgbF(qreal *r, qreal *g, qreal *b, qreal *a) const -
263{ -
264 if (!r || !g || !b)
partially evaluated: !r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
265 return;
never executed: return;
0
266 -
267 if (cspec != Invalid && cspec != Rgb) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
partially evaluated: cspec != Rgb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
268 toRgb().getRgbF(r, g, b, a); -
269 return;
never executed: return;
0
270 } -
271 -
272 *r = ct.argb.red / qreal((32767 * 2 + 1)); -
273 *g = ct.argb.green / qreal((32767 * 2 + 1)); -
274 *b = ct.argb.blue / qreal((32767 * 2 + 1)); -
275 -
276 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
0-262144
277 *a = ct.argb.alpha / qreal((32767 * 2 + 1));
executed: *a = ct.argb.alpha / qreal((32767 * 2 + 1));
Execution Count:262144
262144
278 -
279}
executed: }
Execution Count:262144
262144
280void QColor::getRgb(int *r, int *g, int *b, int *a) const -
281{ -
282 if (!r || !g || !b)
partially evaluated: !r
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
partially evaluated: !b
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
283 return;
never executed: return;
0
284 -
285 if (cspec != Invalid && cspec != Rgb) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
partially evaluated: cspec != Rgb
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262144
0-262144
286 toRgb().getRgb(r, g, b, a); -
287 return;
never executed: return;
0
288 } -
289 -
290 *r = ct.argb.red >> 8; -
291 *g = ct.argb.green >> 8; -
292 *b = ct.argb.blue >> 8; -
293 -
294 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:262144
no
Evaluation Count:0
0-262144
295 *a = ct.argb.alpha >> 8;
executed: *a = ct.argb.alpha >> 8;
Execution Count:262144
262144
296}
executed: }
Execution Count:262144
262144
297void QColor::setRgbF(qreal r, qreal g, qreal b, qreal a) -
298{ -
299 if (r < qreal(0.0) || r > qreal(1.0)
partially evaluated: r < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: r > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
300 || g < qreal(0.0) || g > qreal(1.0)
partially evaluated: g < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: g > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
301 || b < qreal(0.0) || b > qreal(1.0)
partially evaluated: b < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: b > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
302 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:262147
0-262147
303 QMessageLogger("painting/qcolor.cpp", 880, __PRETTY_FUNCTION__).warning("QColor::setRgbF: RGB parameters out of range"); -
304 invalidate(); -
305 return;
never executed: return;
0
306 } -
307 -
308 cspec = Rgb; -
309 ct.argb.alpha = qRound(a * (32767 * 2 + 1)); -
310 ct.argb.red = qRound(r * (32767 * 2 + 1)); -
311 ct.argb.green = qRound(g * (32767 * 2 + 1)); -
312 ct.argb.blue = qRound(b * (32767 * 2 + 1)); -
313 ct.argb.pad = 0; -
314}
executed: }
Execution Count:262147
262147
315void QColor::setRgb(int r, int g, int b, int a) -
316{ -
317 if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
partially evaluated: (uint)r > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286925
partially evaluated: (uint)g > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286926
evaluated: (uint)b > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:4286925
partially evaluated: (uint)a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4286925
0-4286926
318 QMessageLogger("painting/qcolor.cpp", 903, __PRETTY_FUNCTION__).warning("QColor::setRgb: RGB parameters out of range"); -
319 invalidate(); -
320 return;
executed: return;
Execution Count:1
1
321 } -
322 -
323 cspec = Rgb; -
324 ct.argb.alpha = a * 0x101; -
325 ct.argb.red = r * 0x101; -
326 ct.argb.green = g * 0x101; -
327 ct.argb.blue = b * 0x101; -
328 ct.argb.pad = 0; -
329}
executed: }
Execution Count:4286921
4286921
330QRgb QColor::rgba() const -
331{ -
332 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:497468
yes
Evaluation Count:9
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1464
yes
Evaluation Count:496026
9-497468
333 return toRgb().rgba();
executed: return toRgb().rgba();
Execution Count:1464
1464
334 return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
executed: return qRgba(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8, ct.argb.alpha >> 8);
Execution Count:496039
496039
335} -
336 -
337 -
338 -
339 -
340 -
341 -
342void QColor::setRgba(QRgb rgba) -
343{ -
344 cspec = Rgb; -
345 ct.argb.alpha = qAlpha(rgba) * 0x101; -
346 ct.argb.red = qRed(rgba) * 0x101; -
347 ct.argb.green = qGreen(rgba) * 0x101; -
348 ct.argb.blue = qBlue(rgba) * 0x101; -
349 ct.argb.pad = 0; -
350}
executed: }
Execution Count:671
671
351QRgb QColor::rgb() const -
352{ -
353 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:816716
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:93200
yes
Evaluation Count:723516
0-816716
354 return toRgb().rgb();
executed: return toRgb().rgb();
Execution Count:93200
93200
355 return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
executed: return qRgb(ct.argb.red >> 8, ct.argb.green >> 8, ct.argb.blue >> 8);
Execution Count:723516
723516
356} -
357 -
358 -
359 -
360 -
361 -
362 -
363void QColor::setRgb(QRgb rgb) -
364{ -
365 cspec = Rgb; -
366 ct.argb.alpha = 0xffff; -
367 ct.argb.red = qRed(rgb) * 0x101; -
368 ct.argb.green = qGreen(rgb) * 0x101; -
369 ct.argb.blue = qBlue(rgb) * 0x101; -
370 ct.argb.pad = 0; -
371}
executed: }
Execution Count:262829
262829
372 -
373 -
374 -
375 -
376 -
377 -
378int QColor::alpha() const -
379{ return ct.argb.alpha >> 8; }
executed: return ct.argb.alpha >> 8;
Execution Count:498467
498467
380void QColor::setAlpha(int alpha) -
381{ -
382 do { if (alpha < 0 || alpha > 255) { QMessageLogger("painting/qcolor.cpp", 995, __PRETTY_FUNCTION__).warning("\"QColor::setAlpha\""": invalid value %d", alpha); alpha = qMax(0, qMin(alpha, 255)); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:66139
evaluated: alpha < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:66137
evaluated: alpha > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:66136
executed: }
Execution Count:3
executed: }
Execution Count:66139
0-66139
383 ct.argb.alpha = alpha * 0x101; -
384}
executed: }
Execution Count:66139
66139
385 -
386 -
387 -
388 -
389 -
390 -
391qreal QColor::alphaF() const -
392{ return ct.argb.alpha / qreal((32767 * 2 + 1)); }
executed: return ct.argb.alpha / qreal((32767 * 2 + 1));
Execution Count:327694
327694
393void QColor::setAlphaF(qreal alpha) -
394{ -
395 do { if (alpha < qreal(0.0) || alpha > qreal(1.0)) { QMessageLogger("painting/qcolor.cpp", 1016, __PRETTY_FUNCTION__).warning("\"QColor::setAlphaF\""": invalid value %g", alpha); alpha = qMax(qreal(0.0), qMin(alpha, qreal(1.0))); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65559
evaluated: alpha < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65558
evaluated: alpha > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:65557
executed: }
Execution Count:2
executed: }
Execution Count:65559
0-65559
396 qreal tmp = alpha * (32767 * 2 + 1); -
397 ct.argb.alpha = qRound(tmp); -
398}
executed: }
Execution Count:65559
65559
399 -
400 -
401 -
402 -
403 -
404 -
405 -
406int QColor::red() const -
407{ -
408 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:972972
yes
Evaluation Count:5
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972675
5-972972
409 return toRgb().red();
executed: return toRgb().red();
Execution Count:297
297
410 return ct.argb.red >> 8;
executed: return ct.argb.red >> 8;
Execution Count:972680
972680
411} -
412 -
413 -
414 -
415 -
416 -
417 -
418 -
419void QColor::setRed(int red) -
420{ -
421 do { if (red < 0 || red > 255) { QMessageLogger("painting/qcolor.cpp", 1042, __PRETTY_FUNCTION__).warning("\"QColor::setRed\""": invalid value %d", red); red = qMax(0, qMin(red, 255)); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: red < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: red > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
executed: }
Execution Count:3
executed: }
Execution Count:315
0-315
422 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:152
yes
Evaluation Count:163
152-163
423 setRgb(red, green(), blue(), alpha());
executed: setRgb(red, green(), blue(), alpha());
Execution Count:152
152
424 else -
425 ct.argb.red = red * 0x101;
executed: ct.argb.red = red * 0x101;
Execution Count:163
163
426} -
427 -
428 -
429 -
430 -
431 -
432 -
433int QColor::green() const -
434{ -
435 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:973122
yes
Evaluation Count:6
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972825
6-973122
436 return toRgb().green();
executed: return toRgb().green();
Execution Count:297
297
437 return ct.argb.green >> 8;
executed: return ct.argb.green >> 8;
Execution Count:972831
972831
438} -
439 -
440 -
441 -
442 -
443 -
444 -
445 -
446void QColor::setGreen(int green) -
447{ -
448 do { if (green < 0 || green > 255) { QMessageLogger("painting/qcolor.cpp", 1069, __PRETTY_FUNCTION__).warning("\"QColor::setGreen\""": invalid value %d", green); green = qMax(0, qMin(green, 255)); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: green < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: green > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
executed: }
Execution Count:3
executed: }
Execution Count:315
0-315
449 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:314
1-314
450 setRgb(red(), green, blue(), alpha());
executed: setRgb(red(), green, blue(), alpha());
Execution Count:1
1
451 else -
452 ct.argb.green = green * 0x101;
executed: ct.argb.green = green * 0x101;
Execution Count:314
314
453} -
454 -
455 -
456 -
457 -
458 -
459 -
460 -
461int QColor::blue() const -
462{ -
463 if (cspec != Invalid && cspec != Rgb)
evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:973122
yes
Evaluation Count:6
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:297
yes
Evaluation Count:972825
6-973122
464 return toRgb().blue();
executed: return toRgb().blue();
Execution Count:297
297
465 return ct.argb.blue >> 8;
executed: return ct.argb.blue >> 8;
Execution Count:972831
972831
466} -
467void QColor::setBlue(int blue) -
468{ -
469 do { if (blue < 0 || blue > 255) { QMessageLogger("painting/qcolor.cpp", 1098, __PRETTY_FUNCTION__).warning("\"QColor::setBlue\""": invalid value %d", blue); blue = qMax(0, qMin(blue, 255)); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:315
evaluated: blue < 0
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:313
evaluated: blue > 255
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:312
executed: }
Execution Count:3
executed: }
Execution Count:315
0-315
470 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:314
1-314
471 setRgb(red(), green(), blue, alpha());
executed: setRgb(red(), green(), blue, alpha());
Execution Count:1
1
472 else -
473 ct.argb.blue = blue * 0x101;
executed: ct.argb.blue = blue * 0x101;
Execution Count:314
314
474} -
475 -
476 -
477 -
478 -
479 -
480 -
481qreal QColor::redF() const -
482{ -
483 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
484 return toRgb().redF();
executed: return toRgb().redF();
Execution Count:2
2
485 return ct.argb.red / qreal((32767 * 2 + 1));
executed: return ct.argb.red / qreal((32767 * 2 + 1));
Execution Count:65549
65549
486} -
487void QColor::setRedF(qreal red) -
488{ -
489 do { if (red < qreal(0.0) || red > qreal(1.0)) { QMessageLogger("painting/qcolor.cpp", 1126, __PRETTY_FUNCTION__).warning("\"QColor::setRedF\""": invalid value %g", red); red = qMax(qreal(0.0), qMin(red, qreal(1.0))); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: red < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: red > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
executed: }
Execution Count:2
executed: }
Execution Count:4
0-4
490 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
491 setRgbF(red, greenF(), blueF(), alphaF());
executed: setRgbF(red, greenF(), blueF(), alphaF());
Execution Count:1
1
492 else -
493 ct.argb.red = qRound(red * (32767 * 2 + 1));
executed: ct.argb.red = qRound(red * (32767 * 2 + 1));
Execution Count:3
3
494} -
495 -
496 -
497 -
498 -
499 -
500 -
501qreal QColor::greenF() const -
502{ -
503 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
504 return toRgb().greenF();
executed: return toRgb().greenF();
Execution Count:2
2
505 return ct.argb.green / qreal((32767 * 2 + 1));
executed: return ct.argb.green / qreal((32767 * 2 + 1));
Execution Count:65549
65549
506} -
507void QColor::setGreenF(qreal green) -
508{ -
509 do { if (green < qreal(0.0) || green > qreal(1.0)) { QMessageLogger("painting/qcolor.cpp", 1154, __PRETTY_FUNCTION__).warning("\"QColor::setGreenF\""": invalid value %g", green); green = qMax(qreal(0.0), qMin(green, qreal(1.0))); } } while (0);
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: green < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: green > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
executed: }
Execution Count:2
executed: }
Execution Count:4
0-4
510 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
511 setRgbF(redF(), green, blueF(), alphaF());
executed: setRgbF(redF(), green, blueF(), alphaF());
Execution Count:1
1
512 else -
513 ct.argb.green = qRound(green * (32767 * 2 + 1));
executed: ct.argb.green = qRound(green * (32767 * 2 + 1));
Execution Count:3
3
514} -
515 -
516 -
517 -
518 -
519 -
520 -
521qreal QColor::blueF() const -
522{ -
523 if (cspec != Invalid && cspec != Rgb)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65551
no
Evaluation Count:0
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:65549
0-65551
524 return toRgb().blueF();
executed: return toRgb().blueF();
Execution Count:2
2
525 return ct.argb.blue / qreal((32767 * 2 + 1));
executed: return ct.argb.blue / qreal((32767 * 2 + 1));
Execution Count:65549
65549
526} -
527 -
528 -
529 -
530 -
531 -
532 -
533 -
534void QColor::setBlueF(qreal blue) -
535{ -
536 do { if (blue < qreal(0.0) || blue > qreal(1.0)) { QMessageLogger("painting/qcolor.cpp", 1181, __PRETTY_FUNCTION__).warning("\"QColor::setBlueF\""": invalid value %g", blue); blue = qMax(qreal(0.0), qMin(blue, qreal(1.0))); } } while (0);
executed: }
Execution Count:4
partially evaluated: 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
evaluated: blue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
evaluated: blue > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:2
executed: }
Execution Count:2
0-4
537 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
538 setRgbF(redF(), greenF(), blue, alphaF());
executed: setRgbF(redF(), greenF(), blue, alphaF());
Execution Count:1
1
539 else -
540 ct.argb.blue = qRound(blue * (32767 * 2 + 1));
executed: ct.argb.blue = qRound(blue * (32767 * 2 + 1));
Execution Count:3
3
541} -
542int QColor::hue() const -
543{ -
544 return hsvHue();
executed: return hsvHue();
Execution Count:37731
37731
545} -
546 -
547 -
548 -
549 -
550 -
551 -
552int QColor::hsvHue() const -
553{ -
554 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:37731
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:865
yes
Evaluation Count:36866
0-37731
555 return toHsv().hue();
executed: return toHsv().hue();
Execution Count:865
865
556 return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;
executed: return ct.ahsv.hue == (32767 * 2 + 1) ? -1 : ct.ahsv.hue / 100;
Execution Count:36866
36866
557} -
558int QColor::saturation() const -
559{ -
560 return hsvSaturation();
executed: return hsvSaturation();
Execution Count:67267
67267
561} -
562 -
563 -
564 -
565 -
566 -
567 -
568int QColor::hsvSaturation() const -
569{ -
570 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:67267
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:865
yes
Evaluation Count:66402
0-67267
571 return toHsv().saturation();
executed: return toHsv().saturation();
Execution Count:865
865
572 return ct.ahsv.saturation >> 8;
executed: return ct.ahsv.saturation >> 8;
Execution Count:66402
66402
573} -
574 -
575 -
576 -
577 -
578 -
579 -
580int QColor::value() const -
581{ -
582 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:68859
no
Evaluation Count:0
evaluated: cspec != Hsv
TRUEFALSE
yes
Evaluation Count:1661
yes
Evaluation Count:67198
0-68859
583 return toHsv().value();
executed: return toHsv().value();
Execution Count:1661
1661
584 return ct.ahsv.value >> 8;
executed: return ct.ahsv.value >> 8;
Execution Count:67198
67198
585} -
586qreal QColor::hueF() const -
587{ -
588 return hsvHueF();
executed: return hsvHueF();
Execution Count:36000
36000
589} -
590 -
591 -
592 -
593 -
594 -
595 -
596 -
597qreal QColor::hsvHueF() const -
598{ -
599 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36000
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36000
0-36000
600 return toHsv().hueF();
never executed: return toHsv().hueF();
0
601 return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
executed: return ct.ahsv.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsv.hue / qreal(36000.0);
Execution Count:36000
36000
602} -
603qreal QColor::saturationF() const -
604{ -
605 return hsvSaturationF();
executed: return hsvSaturationF();
Execution Count:65536
65536
606} -
607 -
608 -
609 -
610 -
611 -
612 -
613qreal QColor::hsvSaturationF() const -
614{ -
615 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
616 return toHsv().saturationF();
never executed: return toHsv().saturationF();
0
617 return ct.ahsv.saturation / qreal((32767 * 2 + 1));
executed: return ct.ahsv.saturation / qreal((32767 * 2 + 1));
Execution Count:65536
65536
618} -
619 -
620 -
621 -
622 -
623 -
624 -
625qreal QColor::valueF() const -
626{ -
627 if (cspec != Invalid && cspec != Hsv)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsv
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
628 return toHsv().valueF();
never executed: return toHsv().valueF();
0
629 return ct.ahsv.value / qreal((32767 * 2 + 1));
executed: return ct.ahsv.value / qreal((32767 * 2 + 1));
Execution Count:65536
65536
630} -
631int QColor::hslHue() const -
632{ -
633 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36001
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36001
0-36001
634 return toHsl().hslHue();
never executed: return toHsl().hslHue();
0
635 return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;
executed: return ct.ahsl.hue == (32767 * 2 + 1) ? -1 : ct.ahsl.hue / 100;
Execution Count:36001
36001
636} -
637int QColor::hslSaturation() const -
638{ -
639 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
640 return toHsl().hslSaturation();
never executed: return toHsl().hslSaturation();
0
641 return ct.ahsl.saturation >> 8;
executed: return ct.ahsl.saturation >> 8;
Execution Count:65536
65536
642} -
643int QColor::lightness() const -
644{ -
645 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
646 return toHsl().lightness();
never executed: return toHsl().lightness();
0
647 return ct.ahsl.lightness >> 8;
executed: return ct.ahsl.lightness >> 8;
Execution Count:65536
65536
648} -
649qreal QColor::hslHueF() const -
650{ -
651 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:36000
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:36000
0-36000
652 return toHsl().hslHueF();
never executed: return toHsl().hslHueF();
0
653 return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
executed: return ct.ahsl.hue == (32767 * 2 + 1) ? qreal(-1.0) : ct.ahsl.hue / qreal(36000.0);
Execution Count:36000
36000
654} -
655qreal QColor::hslSaturationF() const -
656{ -
657 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
658 return toHsl().hslSaturationF();
never executed: return toHsl().hslSaturationF();
0
659 return ct.ahsl.saturation / qreal((32767 * 2 + 1));
executed: return ct.ahsl.saturation / qreal((32767 * 2 + 1));
Execution Count:65536
65536
660} -
661qreal QColor::lightnessF() const -
662{ -
663 if (cspec != Invalid && cspec != Hsl)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Hsl
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
664 return toHsl().lightnessF();
never executed: return toHsl().lightnessF();
0
665 return ct.ahsl.lightness / qreal((32767 * 2 + 1));
executed: return ct.ahsl.lightness / qreal((32767 * 2 + 1));
Execution Count:65536
65536
666} -
667 -
668 -
669 -
670 -
671 -
672 -
673int QColor::cyan() const -
674{ -
675 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
676 return toCmyk().cyan();
never executed: return toCmyk().cyan();
0
677 return ct.acmyk.cyan >> 8;
executed: return ct.acmyk.cyan >> 8;
Execution Count:65536
65536
678} -
679 -
680 -
681 -
682 -
683 -
684 -
685int QColor::magenta() const -
686{ -
687 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
688 return toCmyk().magenta();
never executed: return toCmyk().magenta();
0
689 return ct.acmyk.magenta >> 8;
executed: return ct.acmyk.magenta >> 8;
Execution Count:65536
65536
690} -
691 -
692 -
693 -
694 -
695 -
696 -
697int QColor::yellow() const -
698{ -
699 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
700 return toCmyk().yellow();
never executed: return toCmyk().yellow();
0
701 return ct.acmyk.yellow >> 8;
executed: return ct.acmyk.yellow >> 8;
Execution Count:65536
65536
702} -
703 -
704 -
705 -
706 -
707 -
708 -
709 -
710int QColor::black() const -
711{ -
712 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
713 return toCmyk().black();
never executed: return toCmyk().black();
0
714 return ct.acmyk.black >> 8;
executed: return ct.acmyk.black >> 8;
Execution Count:65536
65536
715} -
716 -
717 -
718 -
719 -
720 -
721 -
722qreal QColor::cyanF() const -
723{ -
724 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
725 return toCmyk().cyanF();
never executed: return toCmyk().cyanF();
0
726 return ct.acmyk.cyan / qreal((32767 * 2 + 1));
executed: return ct.acmyk.cyan / qreal((32767 * 2 + 1));
Execution Count:65536
65536
727} -
728 -
729 -
730 -
731 -
732 -
733 -
734qreal QColor::magentaF() const -
735{ -
736 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
737 return toCmyk().magentaF();
never executed: return toCmyk().magentaF();
0
738 return ct.acmyk.magenta / qreal((32767 * 2 + 1));
executed: return ct.acmyk.magenta / qreal((32767 * 2 + 1));
Execution Count:65536
65536
739} -
740 -
741 -
742 -
743 -
744 -
745 -
746qreal QColor::yellowF() const -
747{ -
748 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
749 return toCmyk().yellowF();
never executed: return toCmyk().yellowF();
0
750 return ct.acmyk.yellow / qreal((32767 * 2 + 1));
executed: return ct.acmyk.yellow / qreal((32767 * 2 + 1));
Execution Count:65536
65536
751} -
752 -
753 -
754 -
755 -
756 -
757 -
758qreal QColor::blackF() const -
759{ -
760 if (cspec != Invalid && cspec != Cmyk)
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:65536
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:65536
0-65536
761 return toCmyk().blackF();
never executed: return toCmyk().blackF();
0
762 return ct.acmyk.black / qreal((32767 * 2 + 1));
executed: return ct.acmyk.black / qreal((32767 * 2 + 1));
Execution Count:65536
65536
763} -
764 -
765 -
766 -
767 -
768 -
769 -
770QColor QColor::toRgb() const -
771{ -
772 if (!isValid() || cspec == Rgb)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:168344
evaluated: cspec == Rgb
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:168343
1-168344
773 return *this;
executed: return *this;
Execution Count:10
10
774 -
775 QColor color; -
776 color.cspec = Rgb; -
777 color.ct.argb.alpha = ct.argb.alpha; -
778 color.ct.argb.pad = 0; -
779 -
780 switch (cspec) { -
781 case Hsv: -
782 { -
783 if (ct.ahsv.saturation == 0 || ct.ahsv.hue == (32767 * 2 + 1)) {
evaluated: ct.ahsv.saturation == 0
TRUEFALSE
yes
Evaluation Count:9673
yes
Evaluation Count:93109
partially evaluated: ct.ahsv.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:93109
0-93109
784 -
785 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsv.value; -
786 break;
executed: break;
Execution Count:9673
9673
787 } -
788 -
789 -
790 const qreal h = ct.ahsv.hue == 36000 ? 0 : ct.ahsv.hue / 6000.;
evaluated: ct.ahsv.hue == 36000
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:93108
1-93108
791 const qreal s = ct.ahsv.saturation / qreal((32767 * 2 + 1)); -
792 const qreal v = ct.ahsv.value / qreal((32767 * 2 + 1)); -
793 const int i = int(h); -
794 const qreal f = h - i; -
795 const qreal p = v * (qreal(1.0) - s); -
796 -
797 if (i & 1) {
evaluated: i & 1
TRUEFALSE
yes
Evaluation Count:44194
yes
Evaluation Count:48915
44194-48915
798 const qreal q = v * (qreal(1.0) - (s * f)); -
799 -
800 switch (i) { -
801 case 1: -
802 color.ct.argb.red = qRound(q * (32767 * 2 + 1)); -
803 color.ct.argb.green = qRound(v * (32767 * 2 + 1)); -
804 color.ct.argb.blue = qRound(p * (32767 * 2 + 1)); -
805 break;
executed: break;
Execution Count:14737
14737
806 case 3: -
807 color.ct.argb.red = qRound(p * (32767 * 2 + 1)); -
808 color.ct.argb.green = qRound(q * (32767 * 2 + 1)); -
809 color.ct.argb.blue = qRound(v * (32767 * 2 + 1)); -
810 break;
executed: break;
Execution Count:14729
14729
811 case 5: -
812 color.ct.argb.red = qRound(v * (32767 * 2 + 1)); -
813 color.ct.argb.green = qRound(p * (32767 * 2 + 1)); -
814 color.ct.argb.blue = qRound(q * (32767 * 2 + 1)); -
815 break;
executed: break;
Execution Count:14728
14728
816 } -
817 } else {
executed: }
Execution Count:44194
44194
818 const qreal t = v * (qreal(1.0) - (s * (qreal(1.0) - f))); -
819 -
820 switch (i) { -
821 case 0: -
822 color.ct.argb.red = qRound(v * (32767 * 2 + 1)); -
823 color.ct.argb.green = qRound(t * (32767 * 2 + 1)); -
824 color.ct.argb.blue = qRound(p * (32767 * 2 + 1)); -
825 break;
executed: break;
Execution Count:19379
19379
826 case 2: -
827 color.ct.argb.red = qRound(p * (32767 * 2 + 1)); -
828 color.ct.argb.green = qRound(v * (32767 * 2 + 1)); -
829 color.ct.argb.blue = qRound(t * (32767 * 2 + 1)); -
830 break;
executed: break;
Execution Count:14344
14344
831 case 4: -
832 color.ct.argb.red = qRound(t * (32767 * 2 + 1)); -
833 color.ct.argb.green = qRound(p * (32767 * 2 + 1)); -
834 color.ct.argb.blue = qRound(v * (32767 * 2 + 1)); -
835 break;
executed: break;
Execution Count:15192
15192
836 } -
837 }
executed: }
Execution Count:48915
48915
838 break;
executed: break;
Execution Count:93109
93109
839 } -
840 case Hsl: -
841 { -
842 if (ct.ahsl.saturation == 0 || ct.ahsl.hue == (32767 * 2 + 1)) {
evaluated: ct.ahsl.saturation == 0
TRUEFALSE
yes
Evaluation Count:65540
yes
Evaluation Count:8
partially evaluated: ct.ahsl.hue == (32767 * 2 + 1)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-65540
843 -
844 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = ct.ahsl.lightness; -
845 } else if (ct.ahsl.lightness == 0) {
executed: }
Execution Count:65540
partially evaluated: ct.ahsl.lightness == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-65540
846 -
847 color.ct.argb.red = color.ct.argb.green = color.ct.argb.blue = 0; -
848 } else {
never executed: }
0
849 -
850 const qreal h = ct.ahsl.hue == 36000 ? 0 : ct.ahsl.hue / 36000.;
partially evaluated: ct.ahsl.hue == 36000
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
851 const qreal s = ct.ahsl.saturation / qreal((32767 * 2 + 1)); -
852 const qreal l = ct.ahsl.lightness / qreal((32767 * 2 + 1)); -
853 -
854 qreal temp2; -
855 if (l < qreal(0.5))
partially evaluated: l < qreal(0.5)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
856 temp2 = l * (qreal(1.0) + s);
never executed: temp2 = l * (qreal(1.0) + s);
0
857 else -
858 temp2 = l + s - (l * s);
executed: temp2 = l + s - (l * s);
Execution Count:8
8
859 -
860 const qreal temp1 = (qreal(2.0) * l) - temp2; -
861 qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)), -
862 h, -
863 h - (qreal(1.0) / qreal(3.0)) }; -
864 -
865 for (int i = 0; i != 3; ++i) {
evaluated: i != 3
TRUEFALSE
yes
Evaluation Count:24
yes
Evaluation Count:8
8-24
866 if (temp3[i] < qreal(0.0))
evaluated: temp3[i] < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
867 temp3[i] += qreal(1.0);
executed: temp3[i] += qreal(1.0);
Execution Count:2
2
868 else if (temp3[i] > qreal(1.0))
evaluated: temp3[i] > qreal(1.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:20
2-20
869 temp3[i] -= qreal(1.0);
executed: temp3[i] -= qreal(1.0);
Execution Count:2
2
870 -
871 const qreal sixtemp3 = temp3[i] * qreal(6.0); -
872 if (sixtemp3 < qreal(1.0))
evaluated: sixtemp3 < qreal(1.0)
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:22
2-22
873 color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1));
executed: color.ct.array[i+1] = qRound((temp1 + (temp2 - temp1) * sixtemp3) * (32767 * 2 + 1));
Execution Count:2
2
874 else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
evaluated: (temp3[i] * qreal(2.0)) < qreal(1.0)
TRUEFALSE
yes
Evaluation Count:8
yes
Evaluation Count:14
8-14
875 color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1));
executed: color.ct.array[i+1] = qRound(temp2 * (32767 * 2 + 1));
Execution Count:8
8
876 else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
evaluated: (temp3[i] * qreal(3.0)) < qreal(2.0)
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:9
5-9
877 color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1));
executed: color.ct.array[i+1] = qRound((temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0)) * (32767 * 2 + 1));
Execution Count:5
5
878 else -
879 color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1));
executed: color.ct.array[i+1] = qRound(temp1 * (32767 * 2 + 1));
Execution Count:9
9
880 } -
881 color.ct.argb.red = color.ct.argb.red == 1 ? 0 : color.ct.argb.red;
evaluated: color.ct.argb.red == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
882 color.ct.argb.green = color.ct.argb.green == 1 ? 0 : color.ct.argb.green;
evaluated: color.ct.argb.green == 1
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:4
4
883 color.ct.argb.blue = color.ct.argb.blue == 1 ? 0 : color.ct.argb.blue;
evaluated: color.ct.argb.blue == 1
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:5
3-5
884 }
executed: }
Execution Count:8
8
885 break;
executed: break;
Execution Count:65548
65548
886 } -
887 case Cmyk: -
888 { -
889 const qreal c = ct.acmyk.cyan / qreal((32767 * 2 + 1)); -
890 const qreal m = ct.acmyk.magenta / qreal((32767 * 2 + 1)); -
891 const qreal y = ct.acmyk.yellow / qreal((32767 * 2 + 1)); -
892 const qreal k = ct.acmyk.black / qreal((32767 * 2 + 1)); -
893 -
894 color.ct.argb.red = qRound((qreal(1.0) - (c * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); -
895 color.ct.argb.green = qRound((qreal(1.0) - (m * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); -
896 color.ct.argb.blue = qRound((qreal(1.0) - (y * (qreal(1.0) - k) + k)) * (32767 * 2 + 1)); -
897 break;
executed: break;
Execution Count:13
13
898 } -
899 default: -
900 break;
never executed: break;
0
901 } -
902 -
903 return color;
executed: return color;
Execution Count:168343
168343
904} -
905QColor QColor::toHsv() const -
906{ -
907 if (!isValid() || cspec == Hsv)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:144624
evaluated: cspec == Hsv
TRUEFALSE
yes
Evaluation Count:1643
yes
Evaluation Count:142981
2-144624
908 return *this;
executed: return *this;
Execution Count:1645
1645
909 -
910 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:65539
yes
Evaluation Count:77442
65539-77442
911 return toRgb().toHsv();
executed: return toRgb().toHsv();
Execution Count:65539
65539
912 -
913 QColor color; -
914 color.cspec = Hsv; -
915 color.ct.ahsv.alpha = ct.argb.alpha; -
916 color.ct.ahsv.pad = 0; -
917 -
918 const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); -
919 const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); -
920 const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); -
921 const qreal max = ( ( r > g && r > b) ? r : (g > b ? g : b) );
evaluated: r > g
TRUEFALSE
yes
Evaluation Count:5162
yes
Evaluation Count:72280
evaluated: r > b
TRUEFALSE
yes
Evaluation Count:5143
yes
Evaluation Count:19
19-72280
922 const qreal min = ( ( r < g && r < b) ? r : (g < b ? g : b) );
evaluated: r < g
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:77415
evaluated: r < b
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:18
9-77415
923 const qreal delta = max - min; -
924 color.ct.ahsv.value = qRound(max * (32767 * 2 + 1)); -
925 if (qFuzzyIsNull(delta)) {
evaluated: qFuzzyIsNull(delta)
TRUEFALSE
yes
Evaluation Count:70593
yes
Evaluation Count:6849
6849-70593
926 -
927 color.ct.ahsv.hue = (32767 * 2 + 1); -
928 color.ct.ahsv.saturation = 0; -
929 } else {
executed: }
Execution Count:70593
70593
930 -
931 qreal hue = 0; -
932 color.ct.ahsv.saturation = qRound((delta / max) * (32767 * 2 + 1)); -
933 if (qFuzzyCompare(r, max)) {
evaluated: qFuzzyCompare(r, max)
TRUEFALSE
yes
Evaluation Count:5156
yes
Evaluation Count:1693
1693-5156
934 hue = ((g - b) /delta); -
935 } else if (qFuzzyCompare(g, max)) {
executed: }
Execution Count:5156
evaluated: qFuzzyCompare(g, max)
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:1670
23-5156
936 hue = (qreal(2.0) + (b - r) / delta); -
937 } else if (qFuzzyCompare(b, max)) {
executed: }
Execution Count:23
partially evaluated: qFuzzyCompare(b, max)
TRUEFALSE
yes
Evaluation Count:1670
no
Evaluation Count:0
0-1670
938 hue = (qreal(4.0) + (r - g) / delta); -
939 } else {
executed: }
Execution Count:1670
1670
940 qt_noop(); -
941 }
never executed: }
0
942 hue *= qreal(60.0); -
943 if (hue < qreal(0.0))
evaluated: hue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6846
3-6846
944 hue += qreal(360.0);
executed: hue += qreal(360.0);
Execution Count:3
3
945 color.ct.ahsv.hue = qRound(hue * 100); -
946 }
executed: }
Execution Count:6849
6849
947 -
948 return color;
executed: return color;
Execution Count:77442
77442
949} -
950 -
951 -
952 -
953 -
954 -
955 -
956QColor QColor::toHsl() const -
957{ -
958 if (!isValid() || cspec == Hsl)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14
evaluated: cspec == Hsl
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-14
959 return *this;
executed: return *this;
Execution Count:3
3
960 -
961 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:9
4-9
962 return toRgb().toHsl();
executed: return toRgb().toHsl();
Execution Count:4
4
963 -
964 QColor color; -
965 color.cspec = Hsl; -
966 color.ct.ahsl.alpha = ct.argb.alpha; -
967 color.ct.ahsl.pad = 0; -
968 -
969 const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); -
970 const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); -
971 const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); -
972 const qreal max = ( ( r > g && r > b) ? r : (g > b ? g : b) );
evaluated: r > g
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:3
evaluated: r > b
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3-6
973 const qreal min = ( ( r < g && r < b) ? r : (g < b ? g : b) );
partially evaluated: r < g
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9
never evaluated: r < b
0-9
974 const qreal delta = max - min; -
975 const qreal delta2 = max + min; -
976 const qreal lightness = qreal(0.5) * delta2; -
977 color.ct.ahsl.lightness = qRound(lightness * (32767 * 2 + 1)); -
978 if (qFuzzyIsNull(delta)) {
evaluated: qFuzzyIsNull(delta)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:6
3-6
979 -
980 color.ct.ahsl.hue = (32767 * 2 + 1); -
981 color.ct.ahsl.saturation = 0; -
982 } else {
executed: }
Execution Count:3
3
983 -
984 qreal hue = 0; -
985 if (lightness < qreal(0.5))
partially evaluated: lightness < qreal(0.5)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
986 color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1));
never executed: color.ct.ahsl.saturation = qRound((delta / delta2) * (32767 * 2 + 1));
0
987 else -
988 color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1));
executed: color.ct.ahsl.saturation = qRound((delta / (qreal(2.0) - delta2)) * (32767 * 2 + 1));
Execution Count:6
6
989 if (qFuzzyCompare(r, max)) {
partially evaluated: qFuzzyCompare(r, max)
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
990 hue = ((g - b) /delta); -
991 } else if (qFuzzyCompare(g, max)) {
executed: }
Execution Count:6
never evaluated: qFuzzyCompare(g, max)
0-6
992 hue = (qreal(2.0) + (b - r) / delta); -
993 } else if (qFuzzyCompare(b, max)) {
never executed: }
never evaluated: qFuzzyCompare(b, max)
0
994 hue = (qreal(4.0) + (r - g) / delta); -
995 } else {
never executed: }
0
996 qt_noop(); -
997 }
never executed: }
0
998 hue *= qreal(60.0); -
999 if (hue < qreal(0.0))
evaluated: hue < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
1000 hue += qreal(360.0);
executed: hue += qreal(360.0);
Execution Count:3
3
1001 color.ct.ahsl.hue = qRound(hue * 100); -
1002 }
executed: }
Execution Count:6
6
1003 -
1004 return color;
executed: return color;
Execution Count:9
9
1005} -
1006 -
1007 -
1008 -
1009 -
1010 -
1011 -
1012QColor QColor::toCmyk() const -
1013{ -
1014 if (!isValid() || cspec == Cmyk)
evaluated: !isValid()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:14
evaluated: cspec == Cmyk
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-14
1015 return *this;
executed: return *this;
Execution Count:3
3
1016 if (cspec != Rgb)
evaluated: cspec != Rgb
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:7
6-7
1017 return toRgb().toCmyk();
executed: return toRgb().toCmyk();
Execution Count:6
6
1018 -
1019 QColor color; -
1020 color.cspec = Cmyk; -
1021 color.ct.acmyk.alpha = ct.argb.alpha; -
1022 -
1023 -
1024 const qreal r = ct.argb.red / qreal((32767 * 2 + 1)); -
1025 const qreal g = ct.argb.green / qreal((32767 * 2 + 1)); -
1026 const qreal b = ct.argb.blue / qreal((32767 * 2 + 1)); -
1027 qreal c = qreal(1.0) - r; -
1028 qreal m = qreal(1.0) - g; -
1029 qreal y = qreal(1.0) - b; -
1030 -
1031 -
1032 const qreal k = qMin(c, qMin(m, y)); -
1033 -
1034 if (!qFuzzyIsNull(k - 1)) {
evaluated: !qFuzzyIsNull(k - 1)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:4
3-4
1035 c = (c - k) / (qreal(1.0) - k); -
1036 m = (m - k) / (qreal(1.0) - k); -
1037 y = (y - k) / (qreal(1.0) - k); -
1038 }
executed: }
Execution Count:3
3
1039 -
1040 color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); -
1041 color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); -
1042 color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); -
1043 color.ct.acmyk.black = qRound(k * (32767 * 2 + 1)); -
1044 -
1045 return color;
executed: return color;
Execution Count:7
7
1046} -
1047 -
1048QColor QColor::convertTo(QColor::Spec colorSpec) const -
1049{ -
1050 if (colorSpec == cspec)
evaluated: colorSpec == cspec
TRUEFALSE
yes
Evaluation Count:1642
yes
Evaluation Count:7210
1642-7210
1051 return *this;
executed: return *this;
Execution Count:1642
1642
1052 switch (colorSpec) { -
1053 case Rgb: -
1054 return toRgb();
executed: return toRgb();
Execution Count:7206
7206
1055 case Hsv: -
1056 return toHsv();
executed: return toHsv();
Execution Count:1
1
1057 case Cmyk: -
1058 return toCmyk();
executed: return toCmyk();
Execution Count:1
1
1059 case Hsl: -
1060 return toHsl();
executed: return toHsl();
Execution Count:1
1
1061 case Invalid: -
1062 break;
executed: break;
Execution Count:1
1
1063 } -
1064 return QColor();
executed: return QColor();
Execution Count:1
1
1065} -
1066QColor QColor::fromRgb(QRgb rgb) -
1067{ -
1068 return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
never executed: return fromRgb(qRed(rgb), qGreen(rgb), qBlue(rgb));
0
1069} -
1070QColor QColor::fromRgba(QRgb rgba) -
1071{ -
1072 return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
never executed: return fromRgb(qRed(rgba), qGreen(rgba), qBlue(rgba), qAlpha(rgba));
0
1073} -
1074QColor QColor::fromRgb(int r, int g, int b, int a) -
1075{ -
1076 if (r < 0 || r > 255
partially evaluated: r < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: r > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1077 || g < 0 || g > 255
partially evaluated: g < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: g > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1078 || b < 0 || b > 255
partially evaluated: b < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: b > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1079 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5
0-5
1080 QMessageLogger("painting/qcolor.cpp", 1855, __PRETTY_FUNCTION__).warning("QColor::fromRgb: RGB parameters out of range"); -
1081 return QColor();
never executed: return QColor();
0
1082 } -
1083 -
1084 QColor color; -
1085 color.cspec = Rgb; -
1086 color.ct.argb.alpha = a * 0x101; -
1087 color.ct.argb.red = r * 0x101; -
1088 color.ct.argb.green = g * 0x101; -
1089 color.ct.argb.blue = b * 0x101; -
1090 color.ct.argb.pad = 0; -
1091 return color;
executed: return color;
Execution Count:5
5
1092} -
1093QColor QColor::fromRgbF(qreal r, qreal g, qreal b, qreal a) -
1094{ -
1095 if (r < qreal(0.0) || r > qreal(1.0)
partially evaluated: r < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: r > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1096 || g < qreal(0.0) || g > qreal(1.0)
partially evaluated: g < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: g > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1097 || b < qreal(0.0) || b > qreal(1.0)
partially evaluated: b < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: b > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1098 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:26
0-26
1099 QMessageLogger("painting/qcolor.cpp", 1884, __PRETTY_FUNCTION__).warning("QColor::fromRgbF: RGB parameters out of range"); -
1100 return QColor();
never executed: return QColor();
0
1101 } -
1102 -
1103 QColor color; -
1104 color.cspec = Rgb; -
1105 color.ct.argb.alpha = qRound(a * (32767 * 2 + 1)); -
1106 color.ct.argb.red = qRound(r * (32767 * 2 + 1)); -
1107 color.ct.argb.green = qRound(g * (32767 * 2 + 1)); -
1108 color.ct.argb.blue = qRound(b * (32767 * 2 + 1)); -
1109 color.ct.argb.pad = 0; -
1110 return color;
executed: return color;
Execution Count:26
26
1111} -
1112QColor QColor::fromHsv(int h, int s, int v, int a) -
1113{ -
1114 if (((h < 0 || h >= 360) && h != -1)
partially evaluated: h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: h >= 360
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
never evaluated: h != -1
0-4
1115 || s < 0 || s > 255
partially evaluated: s < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1116 || v < 0 || v > 255
partially evaluated: v < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: v > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1117 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1118 QMessageLogger("painting/qcolor.cpp", 1914, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range"); -
1119 return QColor();
never executed: return QColor();
0
1120 } -
1121 -
1122 QColor color; -
1123 color.cspec = Hsv; -
1124 color.ct.ahsv.alpha = a * 0x101; -
1125 color.ct.ahsv.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1126 color.ct.ahsv.saturation = s * 0x101; -
1127 color.ct.ahsv.value = v * 0x101; -
1128 color.ct.ahsv.pad = 0; -
1129 return color;
executed: return color;
Execution Count:4
4
1130} -
1131QColor QColor::fromHsvF(qreal h, qreal s, qreal v, qreal a) -
1132{ -
1133 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
evaluated: h < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:10
partially evaluated: h != qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-10
1134 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1135 || (v < qreal(0.0) || v > qreal(1.0))
partially evaluated: v < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: v > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1136 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1137 QMessageLogger("painting/qcolor.cpp", 1945, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range"); -
1138 return QColor();
never executed: return QColor();
0
1139 } -
1140 -
1141 QColor color; -
1142 color.cspec = Hsv; -
1143 color.ct.ahsv.alpha = qRound(a * (32767 * 2 + 1)); -
1144 color.ct.ahsv.hue = h == qreal(-1.0) ? (32767 * 2 + 1) : qRound(h * 36000);
evaluated: h == qreal(-1.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
1145 color.ct.ahsv.saturation = qRound(s * (32767 * 2 + 1)); -
1146 color.ct.ahsv.value = qRound(v * (32767 * 2 + 1)); -
1147 color.ct.ahsv.pad = 0; -
1148 return color;
executed: return color;
Execution Count:13
13
1149} -
1150QColor QColor::fromHsl(int h, int s, int l, int a) -
1151{ -
1152 if (((h < 0 || h >= 360) && h != -1)
partially evaluated: h < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: h >= 360
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
never evaluated: h != -1
0-1
1153 || s < 0 || s > 255
partially evaluated: s < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: s > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1154 || l < 0 || l > 255
partially evaluated: l < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: l > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1155 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1156 QMessageLogger("painting/qcolor.cpp", 1977, __PRETTY_FUNCTION__).warning("QColor::fromHsv: HSV parameters out of range"); -
1157 return QColor();
never executed: return QColor();
0
1158 } -
1159 -
1160 QColor color; -
1161 color.cspec = Hsl; -
1162 color.ct.ahsl.alpha = a * 0x101; -
1163 color.ct.ahsl.hue = h == -1 ? (32767 * 2 + 1) : (h % 360) * 100;
partially evaluated: h == -1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1164 color.ct.ahsl.saturation = s * 0x101; -
1165 color.ct.ahsl.lightness = l * 0x101; -
1166 color.ct.ahsl.pad = 0; -
1167 return color;
executed: return color;
Execution Count:1
1
1168} -
1169QColor QColor::fromHslF(qreal h, qreal s, qreal l, qreal a) -
1170{ -
1171 if (((h < qreal(0.0) || h > qreal(1.0)) && h != qreal(-1.0))
evaluated: h < qreal(0.0)
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
partially evaluated: h > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11
partially evaluated: h != qreal(-1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-11
1172 || (s < qreal(0.0) || s > qreal(1.0))
partially evaluated: s < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: s > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1173 || (l < qreal(0.0) || l > qreal(1.0))
partially evaluated: l < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: l > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1174 || (a < qreal(0.0) || a > qreal(1.0))) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14
0-14
1175 QMessageLogger("painting/qcolor.cpp", 2009, __PRETTY_FUNCTION__).warning("QColor::fromHsvF: HSV parameters out of range"); -
1176 return QColor();
never executed: return QColor();
0
1177 } -
1178 -
1179 QColor color; -
1180 color.cspec = Hsl; -
1181 color.ct.ahsl.alpha = qRound(a * (32767 * 2 + 1)); -
1182 color.ct.ahsl.hue = (h == qreal(-1.0)) ? (32767 * 2 + 1) : qRound(h * 36000);
evaluated: (h == qreal(-1.0))
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:11
3-11
1183 if (color.ct.ahsl.hue == 36000)
evaluated: color.ct.ahsl.hue == 36000
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:13
1-13
1184 color.ct.ahsl.hue = 0;
executed: color.ct.ahsl.hue = 0;
Execution Count:1
1
1185 color.ct.ahsl.saturation = qRound(s * (32767 * 2 + 1)); -
1186 color.ct.ahsl.lightness = qRound(l * (32767 * 2 + 1)); -
1187 color.ct.ahsl.pad = 0; -
1188 return color;
executed: return color;
Execution Count:14
14
1189} -
1190void QColor::getCmyk(int *c, int *m, int *y, int *k, int *a) -
1191{ -
1192 if (!c || !m || !y || !k)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !m
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !k
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1193 return;
never executed: return;
0
1194 -
1195 if (cspec != Invalid && cspec != Cmyk) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1196 toCmyk().getCmyk(c, m, y, k, a); -
1197 return;
never executed: return;
0
1198 } -
1199 -
1200 *c = ct.acmyk.cyan >> 8; -
1201 *m = ct.acmyk.magenta >> 8; -
1202 *y = ct.acmyk.yellow >> 8; -
1203 *k = ct.acmyk.black >> 8; -
1204 -
1205 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
0-327680
1206 *a = ct.acmyk.alpha >> 8;
executed: *a = ct.acmyk.alpha >> 8;
Execution Count:327680
327680
1207}
executed: }
Execution Count:327680
327680
1208void QColor::getCmykF(qreal *c, qreal *m, qreal *y, qreal *k, qreal *a) -
1209{ -
1210 if (!c || !m || !y || !k)
partially evaluated: !c
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !m
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !y
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: !k
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1211 return;
never executed: return;
0
1212 -
1213 if (cspec != Invalid && cspec != Cmyk) {
partially evaluated: cspec != Invalid
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
partially evaluated: cspec != Cmyk
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1214 toCmyk().getCmykF(c, m, y, k, a); -
1215 return;
never executed: return;
0
1216 } -
1217 -
1218 *c = ct.acmyk.cyan / qreal((32767 * 2 + 1)); -
1219 *m = ct.acmyk.magenta / qreal((32767 * 2 + 1)); -
1220 *y = ct.acmyk.yellow / qreal((32767 * 2 + 1)); -
1221 *k = ct.acmyk.black / qreal((32767 * 2 + 1)); -
1222 -
1223 if (a)
partially evaluated: a
TRUEFALSE
yes
Evaluation Count:327680
no
Evaluation Count:0
0-327680
1224 *a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
executed: *a = ct.acmyk.alpha / qreal((32767 * 2 + 1));
Execution Count:327680
327680
1225}
executed: }
Execution Count:327680
327680
1226void QColor::setCmyk(int c, int m, int y, int k, int a) -
1227{ -
1228 if (c < 0 || c > 255
partially evaluated: c < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: c > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
1229 || m < 0 || m > 255
partially evaluated: m < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: m > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
1230 || y < 0 || y > 255
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: y > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
1231 || k < 0 || k > 255
partially evaluated: k < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: k > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
1232 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327681
0-327681
1233 QMessageLogger("painting/qcolor.cpp", 2099, __PRETTY_FUNCTION__).warning("QColor::setCmyk: CMYK parameters out of range"); -
1234 return;
never executed: return;
0
1235 } -
1236 -
1237 cspec = Cmyk; -
1238 ct.acmyk.alpha = a * 0x101; -
1239 ct.acmyk.cyan = c * 0x101; -
1240 ct.acmyk.magenta = m * 0x101; -
1241 ct.acmyk.yellow = y * 0x101; -
1242 ct.acmyk.black = k * 0x101; -
1243}
executed: }
Execution Count:327681
327681
1244void QColor::setCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) -
1245{ -
1246 if (c < qreal(0.0) || c > qreal(1.0)
partially evaluated: c < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: c > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1247 || m < qreal(0.0) || m > qreal(1.0)
partially evaluated: m < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: m > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1248 || y < qreal(0.0) || y > qreal(1.0)
partially evaluated: y < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: y > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1249 || k < qreal(0.0) || k > qreal(1.0)
partially evaluated: k < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: k > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1250 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:327680
0-327680
1251 QMessageLogger("painting/qcolor.cpp", 2128, __PRETTY_FUNCTION__).warning("QColor::setCmykF: CMYK parameters out of range"); -
1252 return;
never executed: return;
0
1253 } -
1254 -
1255 cspec = Cmyk; -
1256 ct.acmyk.alpha = qRound(a * (32767 * 2 + 1)); -
1257 ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); -
1258 ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); -
1259 ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); -
1260 ct.acmyk.black = qRound(k * (32767 * 2 + 1)); -
1261}
executed: }
Execution Count:327680
327680
1262QColor QColor::fromCmyk(int c, int m, int y, int k, int a) -
1263{ -
1264 if (c < 0 || c > 255
partially evaluated: c < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: c > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1265 || m < 0 || m > 255
partially evaluated: m < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: m > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1266 || y < 0 || y > 255
partially evaluated: y < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: y > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1267 || k < 0 || k > 255
partially evaluated: k < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: k > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1268 || a < 0 || a > 255) {
partially evaluated: a < 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
partially evaluated: a > 255
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1269 QMessageLogger("painting/qcolor.cpp", 2156, __PRETTY_FUNCTION__).warning("QColor::fromCmyk: CMYK parameters out of range"); -
1270 return QColor();
never executed: return QColor();
0
1271 } -
1272 -
1273 QColor color; -
1274 color.cspec = Cmyk; -
1275 color.ct.acmyk.alpha = a * 0x101; -
1276 color.ct.acmyk.cyan = c * 0x101; -
1277 color.ct.acmyk.magenta = m * 0x101; -
1278 color.ct.acmyk.yellow = y * 0x101; -
1279 color.ct.acmyk.black = k * 0x101; -
1280 return color;
executed: return color;
Execution Count:4
4
1281} -
1282QColor QColor::fromCmykF(qreal c, qreal m, qreal y, qreal k, qreal a) -
1283{ -
1284 if (c < qreal(0.0) || c > qreal(1.0)
partially evaluated: c < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: c > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1285 || m < qreal(0.0) || m > qreal(1.0)
partially evaluated: m < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: m > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1286 || y < qreal(0.0) || y > qreal(1.0)
partially evaluated: y < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: y > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1287 || k < qreal(0.0) || k > qreal(1.0)
partially evaluated: k < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: k > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1288 || a < qreal(0.0) || a > qreal(1.0)) {
partially evaluated: a < qreal(0.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
partially evaluated: a > qreal(1.0)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1289 QMessageLogger("painting/qcolor.cpp", 2188, __PRETTY_FUNCTION__).warning("QColor::fromCmykF: CMYK parameters out of range"); -
1290 return QColor();
never executed: return QColor();
0
1291 } -
1292 -
1293 QColor color; -
1294 color.cspec = Cmyk; -
1295 color.ct.acmyk.alpha = qRound(a * (32767 * 2 + 1)); -
1296 color.ct.acmyk.cyan = qRound(c * (32767 * 2 + 1)); -
1297 color.ct.acmyk.magenta = qRound(m * (32767 * 2 + 1)); -
1298 color.ct.acmyk.yellow = qRound(y * (32767 * 2 + 1)); -
1299 color.ct.acmyk.black = qRound(k * (32767 * 2 + 1)); -
1300 return color;
executed: return color;
Execution Count:13
13
1301} -
1302QColor QColor::light(int factor) const -
1303{ -
1304 if (factor <= 0)
partially evaluated: factor <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3579
0-3579
1305 return *this;
never executed: return *this;
0
1306 else if (factor < 100)
partially evaluated: factor < 100
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3579
0-3579
1307 return darker(10000 / factor);
never executed: return darker(10000 / factor);
0
1308 -
1309 QColor hsv = toHsv(); -
1310 int s = hsv.ct.ahsv.saturation; -
1311 uint v = hsv.ct.ahsv.value; -
1312 -
1313 v = (factor*v)/100; -
1314 if (v > (32767 * 2 + 1)) {
evaluated: v > (32767 * 2 + 1)
TRUEFALSE
yes
Evaluation Count:274
yes
Evaluation Count:3305
274-3305
1315 -
1316 s -= v - (32767 * 2 + 1); -
1317 if (s < 0)
evaluated: s < 0
TRUEFALSE
yes
Evaluation Count:232
yes
Evaluation Count:42
42-232
1318 s = 0;
executed: s = 0;
Execution Count:232
232
1319 v = (32767 * 2 + 1); -
1320 }
executed: }
Execution Count:274
274
1321 -
1322 hsv.ct.ahsv.saturation = s; -
1323 hsv.ct.ahsv.value = v; -
1324 -
1325 -
1326 return hsv.convertTo(cspec);
executed: return hsv.convertTo(cspec);
Execution Count:3579
3579
1327} -
1328QColor QColor::dark(int factor) const -
1329{ -
1330 if (factor <= 0)
partially evaluated: factor <= 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5268
0-5268
1331 return *this;
never executed: return *this;
0
1332 else if (factor < 100)
partially evaluated: factor < 100
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5268
0-5268
1333 return lighter(10000 / factor);
never executed: return lighter(10000 / factor);
0
1334 -
1335 QColor hsv = toHsv(); -
1336 hsv.ct.ahsv.value = (hsv.ct.ahsv.value * 100) / factor; -
1337 -
1338 -
1339 return hsv.convertTo(cspec);
executed: return hsv.convertTo(cspec);
Execution Count:5268
5268
1340} -
1341 -
1342 -
1343 -
1344 -
1345QColor &QColor::operator=(const QColor &color) -
1346{ -
1347 cspec = color.cspec; -
1348 ct.argb = color.ct.argb; -
1349 return *this;
executed: return *this;
Execution Count:428910
428910
1350} -
1351 -
1352 -
1353 -
1354 -
1355QColor &QColor::operator=(Qt::GlobalColor color) -
1356{ -
1357 return operator=(QColor(color));
executed: return operator=(QColor(color));
Execution Count:154
154
1358} -
1359 -
1360 -
1361 -
1362 -
1363 -
1364bool QColor::operator==(const QColor &color) const -
1365{ -
1366 if (cspec == Hsl && cspec == color.cspec) {
evaluated: cspec == Hsl
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:119012
partially evaluated: cspec == color.cspec
TRUEFALSE
yes
Evaluation Count:7
no
Evaluation Count:0
0-119012
1367 return (ct.argb.alpha == color.ct.argb.alpha 7
1368 && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) 7
1369 || (ct.ahsl.hue == color.ct.ahsl.hue)) 7
1370 && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 7
1371 || ct.ahsl.lightness == 0 7
1372 || color.ct.ahsl.lightness == 0 7
1373 || ct.ahsl.lightness == (32767 * 2 + 1) 7
1374 || color.ct.ahsl.lightness == (32767 * 2 + 1)) 7
1375 && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50);
executed: return (ct.argb.alpha == color.ct.argb.alpha && ((((ct.ahsl.hue % 36000) == (color.ct.ahsl.hue % 36000))) || (ct.ahsl.hue == color.ct.ahsl.hue)) && (qAbs(ct.ahsl.saturation - color.ct.ahsl.saturation) < 50 || ct.ahsl.lightness == 0 || color.ct.ahsl.lightness == 0 || ct.ahsl.lightness == (32767 * 2 + 1) || color.ct.ahsl.lightness == (32767 * 2 + 1)) && (qAbs(ct.ahsl.lightness - color.ct.ahsl.lightness)) < 50);
Execution Count:7
7
1376 } else { -
1377 return (cspec == color.cspec 119012
1378 && ct.argb.alpha == color.ct.argb.alpha 119012
1379 && (((cspec == QColor::Hsv) 119012
1380 && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) 119012
1381 || (ct.ahsv.hue == color.ct.ahsv.hue)) 119012
1382 && ct.argb.green == color.ct.argb.green 119012
1383 && ct.argb.blue == color.ct.argb.blue 119012
1384 && ct.argb.pad == color.ct.argb.pad);
executed: return (cspec == color.cspec && ct.argb.alpha == color.ct.argb.alpha && (((cspec == QColor::Hsv) && ((ct.ahsv.hue % 36000) == (color.ct.ahsv.hue % 36000))) || (ct.ahsv.hue == color.ct.ahsv.hue)) && ct.argb.green == color.ct.argb.green && ct.argb.blue == color.ct.argb.blue && ct.argb.pad == color.ct.argb.pad);
Execution Count:119012
119012
1385 } -
1386} -
1387 -
1388 -
1389 -
1390 -
1391 -
1392bool QColor::operator!=(const QColor &color) const -
1393{ return !operator==(color); }
executed: return !operator==(color);
Execution Count:107589
107589
1394 -
1395 -
1396 -
1397 -
1398 -
1399QColor::operator QVariant() const -
1400{ -
1401 return QVariant(QVariant::Color, this);
executed: return QVariant(QVariant::Color, this);
Execution Count:3412924
3412924
1402} -
1403 -
1404 -
1405 -
1406 -
1407 -
1408 -
1409void QColor::invalidate() -
1410{ -
1411 cspec = Invalid; -
1412 ct.argb.alpha = (32767 * 2 + 1); -
1413 ct.argb.red = 0; -
1414 ct.argb.green = 0; -
1415 ct.argb.blue = 0; -
1416 ct.argb.pad = 0; -
1417}
executed: }
Execution Count:791672
791672
1418 -
1419 -
1420 -
1421 -
1422 -
1423 -
1424QDebug operator<<(QDebug dbg, const QColor &c) -
1425{ -
1426 if (!c.isValid())
evaluated: !c.isValid()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-3
1427 dbg.nospace() << "QColor(Invalid)";
executed: dbg.nospace() << "QColor(Invalid)";
Execution Count:1
1
1428 else if (c.spec() == QColor::Rgb)
partially evaluated: c.spec() == QColor::Rgb
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
1429 dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
executed: dbg.nospace() << "QColor(ARGB " << c.alphaF() << ", " << c.redF() << ", " << c.greenF() << ", " << c.blueF() << ')';
Execution Count:3
3
1430 else if (c.spec() == QColor::Hsv)
never evaluated: c.spec() == QColor::Hsv
0
1431 dbg.nospace() << "QColor(AHSV " << c.alphaF() << ", " << c.hueF() << ", " << c.saturationF() << ", " << c.valueF() << ')';
never executed: dbg.nospace() << "QColor(AHSV " << c.alphaF() << ", " << c.hueF() << ", " << c.saturationF() << ", " << c.valueF() << ')';
0
1432 else if (c.spec() == QColor::Cmyk)
never evaluated: c.spec() == QColor::Cmyk
0
1433 dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " 0
1434 << c.blackF()<< ')';
never executed: dbg.nospace() << "QColor(ACMYK " << c.alphaF() << ", " << c.cyanF() << ", " << c.magentaF() << ", " << c.yellowF() << ", " << c.blackF()<< ')';
0
1435 else if (c.spec() == QColor::Hsl)
never evaluated: c.spec() == QColor::Hsl
0
1436 dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
never executed: dbg.nospace() << "QColor(AHSL " << c.alphaF() << ", " << c.hslHueF() << ", " << c.hslSaturationF() << ", " << c.lightnessF() << ')';
0
1437 -
1438 return dbg.space();
executed: return dbg.space();
Execution Count:4
4
1439} -
1440QDataStream &operator<<(QDataStream &stream, const QColor &color) -
1441{ -
1442 if (stream.version() < 7) {
evaluated: stream.version() < 7
TRUEFALSE
yes
Evaluation Count:614
yes
Evaluation Count:1065
614-1065
1443 if (!color.isValid())
evaluated: !color.isValid()
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:605
9-605
1444 return stream << quint32(0x49000000);
executed: return stream << quint32(0x49000000);
Execution Count:9
9
1445 quint32 p = (quint32)color.rgb(); -
1446 if (stream.version() == 1)
evaluated: stream.version() == 1
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:563
42-563
1447 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
Execution Count:42
42
1448 return stream << p;
executed: return stream << p;
Execution Count:605
605
1449 } -
1450 -
1451 qint8 s = color.cspec; -
1452 quint16 a = color.ct.argb.alpha; -
1453 quint16 r = color.ct.argb.red; -
1454 quint16 g = color.ct.argb.green; -
1455 quint16 b = color.ct.argb.blue; -
1456 quint16 p = color.ct.argb.pad; -
1457 -
1458 stream << s; -
1459 stream << a; -
1460 stream << r; -
1461 stream << g; -
1462 stream << b; -
1463 stream << p; -
1464 -
1465 return stream;
executed: return stream;
Execution Count:1065
1065
1466} -
1467QDataStream &operator>>(QDataStream &stream, QColor &color) -
1468{ -
1469 if (stream.version() < 7) {
evaluated: stream.version() < 7
TRUEFALSE
yes
Evaluation Count:613
yes
Evaluation Count:1041
613-1041
1470 quint32 p; -
1471 stream >> p; -
1472 if (p == 0x49000000) {
evaluated: p == 0x49000000
TRUEFALSE
yes
Evaluation Count:9
yes
Evaluation Count:604
9-604
1473 color.invalidate(); -
1474 return stream;
executed: return stream;
Execution Count:9
9
1475 } -
1476 if (stream.version() == 1)
evaluated: stream.version() == 1
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:562
42-562
1477 p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
executed: p = ((p << 16) & 0xff0000) | ((p >> 16) & 0xff) | (p & 0xff00ff00);
Execution Count:42
42
1478 color.setRgb(p); -
1479 return stream;
executed: return stream;
Execution Count:604
604
1480 } -
1481 -
1482 qint8 s; -
1483 quint16 a, r, g, b, p; -
1484 stream >> s; -
1485 stream >> a; -
1486 stream >> r; -
1487 stream >> g; -
1488 stream >> b; -
1489 stream >> p; -
1490 -
1491 color.cspec = QColor::Spec(s); -
1492 color.ct.argb.alpha = a; -
1493 color.ct.argb.red = r; -
1494 color.ct.argb.green = g; -
1495 color.ct.argb.blue = b; -
1496 color.ct.argb.pad = p; -
1497 -
1498 return stream;
executed: return stream;
Execution Count:1041
1041
1499} -
1500 -
1501 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial