styles/qdrawutil.cpp

Switch to Source codePreprocessed file
LineSource CodeCoverage
1 -
2 -
3void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, -
4 const QPalette &pal, bool sunken, -
5 int lineWidth, int midLineWidth) -
6{ -
7 if (!(p && lineWidth >= 0 && midLineWidth >= 0)) {
never evaluated: p
never evaluated: lineWidth >= 0
never evaluated: midLineWidth >= 0
0
8 QMessageLogger("styles/qdrawutil.cpp", 99, __PRETTY_FUNCTION__).warning("qDrawShadeLine: Invalid parameters"); -
9 return;
never executed: return;
0
10 } -
11 int tlw = lineWidth*2 + midLineWidth; -
12 QPen oldPen = p->pen(); -
13 if (sunken)
never evaluated: sunken
0
14 p->setPen(pal.color(QPalette::Dark));
never executed: p->setPen(pal.color(QPalette::Dark));
0
15 else -
16 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
17 QPolygon a; -
18 int i; -
19 if (y1 == y2) {
never evaluated: y1 == y2
0
20 int y = y1 - tlw/2; -
21 if (x1 > x2) {
never evaluated: x1 > x2
0
22 int t = x1; -
23 x1 = x2; -
24 x2 = t; -
25 }
never executed: }
0
26 x2--; -
27 for (i=0; i<lineWidth; i++) {
never evaluated: i<lineWidth
0
28 a.setPoints(3, x1+i, y+tlw-1-i, -
29 x1+i, y+i, -
30 x2-i, y+i); -
31 p->drawPolyline(a); -
32 }
never executed: }
0
33 if (midLineWidth > 0) {
never evaluated: midLineWidth > 0
0
34 p->setPen(pal.mid().color()); -
35 for (i=0; i<midLineWidth; i++)
never evaluated: i<midLineWidth
0
36 p->drawLine(x1+lineWidth, y+lineWidth+i, 0
37 x2-lineWidth, y+lineWidth+i);
never executed: p->drawLine(x1+lineWidth, y+lineWidth+i, x2-lineWidth, y+lineWidth+i);
0
38 }
never executed: }
0
39 if (sunken)
never evaluated: sunken
0
40 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
41 else -
42 p->setPen(pal.dark().color());
never executed: p->setPen(pal.dark().color());
0
43 for (i=0; i<lineWidth; i++) {
never evaluated: i<lineWidth
0
44 a.setPoints(3, x1+i, y+tlw-i-1, -
45 x2-i, y+tlw-i-1, -
46 x2-i, y+i+1); -
47 p->drawPolyline(a); -
48 }
never executed: }
0
49 }
never executed: }
0
50 else if (x1 == x2) {
never evaluated: x1 == x2
0
51 int x = x1 - tlw/2; -
52 if (y1 > y2) {
never evaluated: y1 > y2
0
53 int t = y1; -
54 y1 = y2; -
55 y2 = t; -
56 }
never executed: }
0
57 y2--; -
58 for (i=0; i<lineWidth; i++) {
never evaluated: i<lineWidth
0
59 a.setPoints(3, x+i, y2, -
60 x+i, y1+i, -
61 x+tlw-1, y1+i); -
62 p->drawPolyline(a); -
63 }
never executed: }
0
64 if (midLineWidth > 0) {
never evaluated: midLineWidth > 0
0
65 p->setPen(pal.mid().color()); -
66 for (i=0; i<midLineWidth; i++)
never evaluated: i<midLineWidth
0
67 p->drawLine(x+lineWidth+i, y1+lineWidth, x+lineWidth+i, y2);
never executed: p->drawLine(x+lineWidth+i, y1+lineWidth, x+lineWidth+i, y2);
0
68 }
never executed: }
0
69 if (sunken)
never evaluated: sunken
0
70 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
71 else -
72 p->setPen(pal.dark().color());
never executed: p->setPen(pal.dark().color());
0
73 for (i=0; i<lineWidth; i++) {
never evaluated: i<lineWidth
0
74 a.setPoints(3, x+lineWidth, y2-i, -
75 x+tlw-i-1, y2-i, -
76 x+tlw-i-1, y1+lineWidth); -
77 p->drawPolyline(a); -
78 }
never executed: }
0
79 }
never executed: }
0
80 p->setPen(oldPen); -
81}
never executed: }
0
82void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, -
83 const QPalette &pal, bool sunken, -
84 int lineWidth, int midLineWidth, -
85 const QBrush *fill) -
86{ -
87 if (w == 0 || h == 0)
partially evaluated: w == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54
partially evaluated: h == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54
0-54
88 return;
never executed: return;
0
89 if (! (w > 0 && h > 0 && lineWidth >= 0 && midLineWidth >= 0)) {
partially evaluated: w > 0
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
partially evaluated: h > 0
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
partially evaluated: lineWidth >= 0
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
partially evaluated: midLineWidth >= 0
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
0-54
90 QMessageLogger("styles/qdrawutil.cpp", 215, __PRETTY_FUNCTION__).warning("qDrawShadeRect: Invalid parameters"); -
91 return;
never executed: return;
0
92 } -
93 QPen oldPen = p->pen(); -
94 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:42
yes
Evaluation Count:12
12-42
95 p->setPen(pal.dark().color());
executed: p->setPen(pal.dark().color());
Execution Count:42
42
96 else -
97 p->setPen(pal.light().color());
executed: p->setPen(pal.light().color());
Execution Count:12
12
98 int x1=x, y1=y, x2=x+w-1, y2=y+h-1; -
99 -
100 if (lineWidth == 1 && midLineWidth == 0) {
evaluated: lineWidth == 1
TRUEFALSE
yes
Evaluation Count:41
yes
Evaluation Count:13
partially evaluated: midLineWidth == 0
TRUEFALSE
yes
Evaluation Count:41
no
Evaluation Count:0
0-41
101 p->drawRect(x1, y1, w-2, h-2); -
102 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:39
yes
Evaluation Count:2
2-39
103 p->setPen(pal.light().color());
executed: p->setPen(pal.light().color());
Execution Count:39
39
104 else -
105 p->setPen(pal.dark().color());
executed: p->setPen(pal.dark().color());
Execution Count:2
2
106 QLineF lines[4] = { QLineF(x1+1, y1+1, x2-2, y1+1), -
107 QLineF(x1+1, y1+2, x1+1, y2-2), -
108 QLineF(x1, y2, x2, y2), -
109 QLineF(x2,y1, x2,y2-1) }; -
110 p->drawLines(lines, 4); -
111 } else {
executed: }
Execution Count:41
41
112 int m = lineWidth+midLineWidth; -
113 int i, j=0, k=m; -
114 for (i=0; i<lineWidth; i++) {
partially evaluated: i<lineWidth
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
115 QLineF lines[4] = { QLineF(x1+i, y2-i, x1+i, y1+i), -
116 QLineF(x1+i, y1+i, x2-i, y1+i), -
117 QLineF(x1+k, y2-k, x2-k, y2-k), -
118 QLineF(x2-k, y2-k, x2-k, y1+k) }; -
119 p->drawLines(lines, 4); -
120 k++; -
121 }
never executed: }
0
122 p->setPen(pal.mid().color()); -
123 j = lineWidth*2; -
124 for (i=0; i<midLineWidth; i++) {
evaluated: i<midLineWidth
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:13
10-13
125 p->drawRect(x1+lineWidth+i, y1+lineWidth+i, w-j-1, h-j-1); -
126 j += 2; -
127 }
executed: }
Execution Count:10
10
128 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:10
3-10
129 p->setPen(pal.light().color());
executed: p->setPen(pal.light().color());
Execution Count:3
3
130 else -
131 p->setPen(pal.dark().color());
executed: p->setPen(pal.dark().color());
Execution Count:10
10
132 k = m; -
133 for (i=0; i<lineWidth; i++) {
partially evaluated: i<lineWidth
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
134 QLineF lines[4] = { QLineF(x1+1+i, y2-i, x2-i, y2-i), -
135 QLineF(x2-i, y2-i, x2-i, y1+i+1), -
136 QLineF(x1+k, y2-k, x1+k, y1+k), -
137 QLineF(x1+k, y1+k, x2-k, y1+k) }; -
138 p->drawLines(lines, 4); -
139 k++; -
140 }
never executed: }
0
141 }
executed: }
Execution Count:13
13
142 if (fill) {
evaluated: fill
TRUEFALSE
yes
Evaluation Count:11
yes
Evaluation Count:43
11-43
143 QBrush oldBrush = p->brush(); -
144 int tlw = lineWidth + midLineWidth; -
145 p->setPen(Qt::NoPen); -
146 p->setBrush(*fill); -
147 p->drawRect(x+tlw, y+tlw, w-2*tlw, h-2*tlw); -
148 p->setBrush(oldBrush); -
149 }
executed: }
Execution Count:11
11
150 p->setPen(oldPen); -
151}
executed: }
Execution Count:54
54
152void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, -
153 const QPalette &pal, bool sunken, -
154 int lineWidth, const QBrush *fill) -
155{ -
156 if (w == 0 || h == 0)
partially evaluated: w == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:139
partially evaluated: h == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:139
0-139
157 return;
never executed: return;
0
158 if (!(w > 0 && h > 0 && lineWidth >= 0)) {
partially evaluated: w > 0
TRUEFALSE
yes
Evaluation Count:139
no
Evaluation Count:0
partially evaluated: h > 0
TRUEFALSE
yes
Evaluation Count:139
no
Evaluation Count:0
partially evaluated: lineWidth >= 0
TRUEFALSE
yes
Evaluation Count:139
no
Evaluation Count:0
0-139
159 QMessageLogger("styles/qdrawutil.cpp", 315, __PRETTY_FUNCTION__).warning("qDrawShadePanel: Invalid parameters"); -
160 }
never executed: }
0
161 QColor shade = pal.dark().color(); -
162 QColor light = pal.light().color(); -
163 if (fill) {
evaluated: fill
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:19
19-120
164 if (fill->color() == shade)
partially evaluated: fill->color() == shade
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
165 shade = pal.shadow().color();
never executed: shade = pal.shadow().color();
0
166 if (fill->color() == light)
partially evaluated: fill->color() == light
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:120
0-120
167 light = pal.midlight().color();
never executed: light = pal.midlight().color();
0
168 }
executed: }
Execution Count:120
120
169 QPen oldPen = p->pen(); -
170 QVector<QLineF> lines; -
171 lines.reserve(2*lineWidth); -
172 -
173 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:17
17-122
174 p->setPen(shade);
executed: p->setPen(shade);
Execution Count:122
122
175 else -
176 p->setPen(light);
executed: p->setPen(light);
Execution Count:17
17
177 int x1, y1, x2, y2; -
178 int i; -
179 x1 = x; -
180 y1 = y2 = y; -
181 x2 = x+w-2; -
182 for (i=0; i<lineWidth; i++) {
evaluated: i<lineWidth
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:139
139
183 lines << QLineF(x1, y1++, x2--, y2++); -
184 }
executed: }
Execution Count:139
139
185 x2 = x1; -
186 y1 = y+h-2; -
187 for (i=0; i<lineWidth; i++) {
evaluated: i<lineWidth
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:139
139
188 lines << QLineF(x1++, y1, x2++, y2--); -
189 }
executed: }
Execution Count:139
139
190 p->drawLines(lines); -
191 lines.clear(); -
192 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:122
yes
Evaluation Count:17
17-122
193 p->setPen(light);
executed: p->setPen(light);
Execution Count:122
122
194 else -
195 p->setPen(shade);
executed: p->setPen(shade);
Execution Count:17
17
196 x1 = x; -
197 y1 = y2 = y+h-1; -
198 x2 = x+w-1; -
199 for (i=0; i<lineWidth; i++) {
evaluated: i<lineWidth
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:139
139
200 lines << QLineF(x1++, y1--, x2, y2--); -
201 }
executed: }
Execution Count:139
139
202 x1 = x2; -
203 y1 = y; -
204 y2 = y+h-lineWidth-1; -
205 for (i=0; i<lineWidth; i++) {
evaluated: i<lineWidth
TRUEFALSE
yes
Evaluation Count:139
yes
Evaluation Count:139
139
206 lines << QLineF(x1--, y1++, x2--, y2); -
207 }
executed: }
Execution Count:139
139
208 p->drawLines(lines); -
209 if (fill)
evaluated: fill
TRUEFALSE
yes
Evaluation Count:120
yes
Evaluation Count:19
19-120
210 p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
executed: p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
Execution Count:120
120
211 p->setPen(oldPen); -
212}
executed: }
Execution Count:139
139
213static void qDrawWinShades(QPainter *p, -
214 int x, int y, int w, int h, -
215 const QColor &c1, const QColor &c2, -
216 const QColor &c3, const QColor &c4, -
217 const QBrush *fill) -
218{ -
219 if (w < 2 || h < 2)
evaluated: w < 2
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:15276
evaluated: h < 2
TRUEFALSE
yes
Evaluation Count:4
yes
Evaluation Count:15272
2-15276
220 return;
executed: return;
Execution Count:6
6
221 QPen oldPen = p->pen(); -
222 QPoint a[3] = { QPoint(x, y+h-2), QPoint(x, y), QPoint(x+w-2, y) }; -
223 p->setPen(c1); -
224 p->drawPolyline(a, 3); -
225 QPoint b[3] = { QPoint(x, y+h-1), QPoint(x+w-1, y+h-1), QPoint(x+w-1, y) }; -
226 p->setPen(c2); -
227 p->drawPolyline(b, 3); -
228 if (w > 4 && h > 4) {
evaluated: w > 4
TRUEFALSE
yes
Evaluation Count:15266
yes
Evaluation Count:6
evaluated: h > 4
TRUEFALSE
yes
Evaluation Count:15263
yes
Evaluation Count:3
3-15266
229 QPoint c[3] = { QPoint(x+1, y+h-3), QPoint(x+1, y+1), QPoint(x+w-3, y+1) }; -
230 p->setPen(c3); -
231 p->drawPolyline(c, 3); -
232 QPoint d[3] = { QPoint(x+1, y+h-2), QPoint(x+w-2, y+h-2), QPoint(x+w-2, y+1) }; -
233 p->setPen(c4); -
234 p->drawPolyline(d, 3); -
235 if (fill)
evaluated: fill
TRUEFALSE
yes
Evaluation Count:12944
yes
Evaluation Count:2319
2319-12944
236 p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
executed: p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
Execution Count:12944
12944
237 }
executed: }
Execution Count:15263
15263
238 p->setPen(oldPen); -
239}
executed: }
Execution Count:15272
15272
240void qDrawWinButton(QPainter *p, int x, int y, int w, int h, -
241 const QPalette &pal, bool sunken, -
242 const QBrush *fill) -
243{ -
244 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:88
yes
Evaluation Count:12567
88-12567
245 qDrawWinShades(p, x, y, w, h, 88
246 pal.shadow().color(), pal.light().color(), pal.dark().color(), 88
247 pal.button().color(), fill);
executed: qDrawWinShades(p, x, y, w, h, pal.shadow().color(), pal.light().color(), pal.dark().color(), pal.button().color(), fill);
Execution Count:88
88
248 else -
249 qDrawWinShades(p, x, y, w, h, 12567
250 pal.light().color(), pal.shadow().color(), pal.button().color(), 12567
251 pal.dark().color(), fill);
executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.button().color(), pal.dark().color(), fill);
Execution Count:12567
12567
252} -
253void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, -
254 const QPalette &pal, bool sunken, -
255 const QBrush *fill) -
256{ -
257 if (sunken)
evaluated: sunken
TRUEFALSE
yes
Evaluation Count:2171
yes
Evaluation Count:452
452-2171
258 qDrawWinShades(p, x, y, w, h, 2171
259 pal.dark().color(), pal.light().color(), pal.shadow().color(), 2171
260 pal.midlight().color(), fill);
executed: qDrawWinShades(p, x, y, w, h, pal.dark().color(), pal.light().color(), pal.shadow().color(), pal.midlight().color(), fill);
Execution Count:2171
2171
261 else -
262 qDrawWinShades(p, x, y, w, h, 452
263 pal.light().color(), pal.shadow().color(), pal.midlight().color(), 452
264 pal.dark().color(), fill);
executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.midlight().color(), pal.dark().color(), fill);
Execution Count:452
452
265} -
266void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, -
267 int lineWidth, const QBrush *fill) -
268{ -
269 if (w == 0 || h == 0)
partially evaluated: w == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:198
partially evaluated: h == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:198
0-198
270 return;
never executed: return;
0
271 if (!(w > 0 && h > 0 && lineWidth >= 0)) {
partially evaluated: w > 0
TRUEFALSE
yes
Evaluation Count:198
no
Evaluation Count:0
partially evaluated: h > 0
TRUEFALSE
yes
Evaluation Count:198
no
Evaluation Count:0
partially evaluated: lineWidth >= 0
TRUEFALSE
yes
Evaluation Count:198
no
Evaluation Count:0
0-198
272 QMessageLogger("styles/qdrawutil.cpp", 521, __PRETTY_FUNCTION__).warning("qDrawPlainRect: Invalid parameters"); -
273 }
never executed: }
0
274 QPen oldPen = p->pen(); -
275 QBrush oldBrush = p->brush(); -
276 p->setPen(c); -
277 p->setBrush(Qt::NoBrush); -
278 for (int i=0; i<lineWidth; i++)
evaluated: i<lineWidth
TRUEFALSE
yes
Evaluation Count:198
yes
Evaluation Count:198
198
279 p->drawRect(x+i, y+i, w-i*2 - 1, h-i*2 - 1);
executed: p->drawRect(x+i, y+i, w-i*2 - 1, h-i*2 - 1);
Execution Count:198
198
280 if (fill) {
partially evaluated: fill
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:198
0-198
281 p->setPen(Qt::NoPen); -
282 p->setBrush(*fill); -
283 p->drawRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2); -
284 }
never executed: }
0
285 p->setPen(oldPen); -
286 p->setBrush(oldBrush); -
287}
executed: }
Execution Count:198
198
288void qDrawShadeLine(QPainter *p, const QPoint &p1, const QPoint &p2, -
289 const QPalette &pal, bool sunken, -
290 int lineWidth, int midLineWidth) -
291{ -
292 qDrawShadeLine(p, p1.x(), p1.y(), p2.x(), p2.y(), pal, sunken, -
293 lineWidth, midLineWidth); -
294}
never executed: }
0
295void qDrawShadeRect(QPainter *p, const QRect &r, -
296 const QPalette &pal, bool sunken, -
297 int lineWidth, int midLineWidth, -
298 const QBrush *fill) -
299{ -
300 qDrawShadeRect(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, -
301 lineWidth, midLineWidth, fill); -
302}
executed: }
Execution Count:11
11
303void qDrawShadePanel(QPainter *p, const QRect &r, -
304 const QPalette &pal, bool sunken, -
305 int lineWidth, const QBrush *fill) -
306{ -
307 qDrawShadePanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, -
308 lineWidth, fill); -
309}
executed: }
Execution Count:127
127
310void qDrawWinButton(QPainter *p, const QRect &r, -
311 const QPalette &pal, bool sunken, const QBrush *fill) -
312{ -
313 qDrawWinButton(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -
314}
executed: }
Execution Count:12655
12655
315void qDrawWinPanel(QPainter *p, const QRect &r, -
316 const QPalette &pal, bool sunken, const QBrush *fill) -
317{ -
318 qDrawWinPanel(p, r.x(), r.y(), r.width(), r.height(), pal, sunken, fill); -
319}
executed: }
Execution Count:2619
2619
320void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c, -
321 int lineWidth, const QBrush *fill) -
322{ -
323 qDrawPlainRect(p, r.x(), r.y(), r.width(), r.height(), c, -
324 lineWidth, fill); -
325}
executed: }
Execution Count:198
198
326typedef QVarLengthArray<QPainter::PixmapFragment, 16> QPixmapFragmentsArray; -
327void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, -
328 const QPixmap &pixmap, const QRect &sourceRect,const QMargins &sourceMargins, -
329 const QTileRules &rules, QDrawBorderPixmap::DrawingHints hints) -
330{ -
331 QPainter::PixmapFragment d; -
332 d.opacity = 1.0; -
333 d.rotation = 0.0; -
334 -
335 QPixmapFragmentsArray opaqueData; -
336 QPixmapFragmentsArray translucentData; -
337 -
338 -
339 const int sourceCenterTop = sourceRect.top() + sourceMargins.top(); -
340 const int sourceCenterLeft = sourceRect.left() + sourceMargins.left(); -
341 const int sourceCenterBottom = sourceRect.bottom() - sourceMargins.bottom() + 1; -
342 const int sourceCenterRight = sourceRect.right() - sourceMargins.right() + 1; -
343 const int sourceCenterWidth = sourceCenterRight - sourceCenterLeft; -
344 const int sourceCenterHeight = sourceCenterBottom - sourceCenterTop; -
345 -
346 const int targetCenterTop = targetRect.top() + targetMargins.top(); -
347 const int targetCenterLeft = targetRect.left() + targetMargins.left(); -
348 const int targetCenterBottom = targetRect.bottom() - targetMargins.bottom() + 1; -
349 const int targetCenterRight = targetRect.right() - targetMargins.right() + 1; -
350 const int targetCenterWidth = targetCenterRight - targetCenterLeft; -
351 const int targetCenterHeight = targetCenterBottom - targetCenterTop; -
352 -
353 QVarLengthArray<qreal, 16> xTarget; -
354 QVarLengthArray<qreal, 16> yTarget; -
355 -
356 int columns = 3; -
357 int rows = 3; -
358 if (rules.horizontal != Qt::StretchTile && sourceCenterWidth != 0)
partially evaluated: rules.horizontal != Qt::StretchTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: sourceCenterWidth != 0
0-2
359 columns = qMax(3, 2 + qCeil(targetCenterWidth / qreal(sourceCenterWidth)));
never executed: columns = qMax(3, 2 + qCeil(targetCenterWidth / qreal(sourceCenterWidth)));
0
360 if (rules.vertical != Qt::StretchTile && sourceCenterHeight != 0)
partially evaluated: rules.vertical != Qt::StretchTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: sourceCenterHeight != 0
0-2
361 rows = qMax(3, 2 + qCeil(targetCenterHeight / qreal(sourceCenterHeight)));
never executed: rows = qMax(3, 2 + qCeil(targetCenterHeight / qreal(sourceCenterHeight)));
0
362 -
363 xTarget.resize(columns + 1); -
364 yTarget.resize(rows + 1); -
365 -
366 bool oldAA = painter->testRenderHint(QPainter::Antialiasing); -
367 if (painter->paintEngine()->type() != QPaintEngine::OpenGL
partially evaluated: painter->paintEngine()->type() != QPaintEngine::OpenGL
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
368 && painter->paintEngine()->type() != QPaintEngine::OpenGL2
partially evaluated: painter->paintEngine()->type() != QPaintEngine::OpenGL2
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
369 && oldAA && painter->combinedTransform().type() != QTransform::TxNone) {
partially evaluated: oldAA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
never evaluated: painter->combinedTransform().type() != QTransform::TxNone
0-2
370 painter->setRenderHint(QPainter::Antialiasing, false); -
371 }
never executed: }
0
372 -
373 xTarget[0] = targetRect.left(); -
374 xTarget[1] = targetCenterLeft; -
375 xTarget[columns - 1] = targetCenterRight; -
376 xTarget[columns] = targetRect.left() + targetRect.width(); -
377 -
378 yTarget[0] = targetRect.top(); -
379 yTarget[1] = targetCenterTop; -
380 yTarget[rows - 1] = targetCenterBottom; -
381 yTarget[rows] = targetRect.top() + targetRect.height(); -
382 -
383 qreal dx = targetCenterWidth; -
384 qreal dy = targetCenterHeight; -
385 -
386 switch (rules.horizontal) { -
387 case Qt::StretchTile: -
388 dx = targetCenterWidth; -
389 break;
executed: break;
Execution Count:2
2
390 case Qt::RepeatTile: -
391 dx = sourceCenterWidth; -
392 break;
never executed: break;
0
393 case Qt::RoundTile: -
394 dx = targetCenterWidth / qreal(columns - 2); -
395 break;
never executed: break;
0
396 } -
397 -
398 for (int i = 2; i < columns - 1; ++i)
partially evaluated: i < columns - 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
399 xTarget[i] = xTarget[i - 1] + dx;
never executed: xTarget[i] = xTarget[i - 1] + dx;
0
400 -
401 switch (rules.vertical) { -
402 case Qt::StretchTile: -
403 dy = targetCenterHeight; -
404 break;
executed: break;
Execution Count:2
2
405 case Qt::RepeatTile: -
406 dy = sourceCenterHeight; -
407 break;
never executed: break;
0
408 case Qt::RoundTile: -
409 dy = targetCenterHeight / qreal(rows - 2); -
410 break;
never executed: break;
0
411 } -
412 -
413 for (int i = 2; i < rows - 1; ++i)
partially evaluated: i < rows - 1
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
414 yTarget[i] = yTarget[i - 1] + dy;
never executed: yTarget[i] = yTarget[i - 1] + dy;
0
415 -
416 -
417 if (targetMargins.top() > 0 && targetMargins.left() > 0 && sourceMargins.top() > 0 && sourceMargins.left() > 0) {
partially evaluated: targetMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: targetMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
418 d.x = (0.5 * (xTarget[1] + xTarget[0])); -
419 d.y = (0.5 * (yTarget[1] + yTarget[0])); -
420 d.sourceLeft = sourceRect.left(); -
421 d.sourceTop = sourceRect.top(); -
422 d.width = sourceMargins.left(); -
423 d.height = sourceMargins.top(); -
424 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; -
425 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; -
426 if (hints & QDrawBorderPixmap::OpaqueTopLeft)
partially evaluated: hints & QDrawBorderPixmap::OpaqueTopLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
427 opaqueData.append(d);
never executed: opaqueData.append(d);
0
428 else -
429 translucentData.append(d);
executed: translucentData.append(d);
Execution Count:2
2
430 } -
431 if (targetMargins.top() > 0 && targetMargins.right() > 0 && sourceMargins.top() > 0 && sourceMargins.right() > 0) {
partially evaluated: targetMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: targetMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
432 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); -
433 d.y = (0.5 * (yTarget[1] + yTarget[0])); -
434 d.sourceLeft = sourceCenterRight; -
435 d.sourceTop = sourceRect.top(); -
436 d.width = sourceMargins.right(); -
437 d.height = sourceMargins.top(); -
438 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; -
439 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; -
440 if (hints & QDrawBorderPixmap::OpaqueTopRight)
partially evaluated: hints & QDrawBorderPixmap::OpaqueTopRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
441 opaqueData.append(d);
never executed: opaqueData.append(d);
0
442 else -
443 translucentData.append(d);
executed: translucentData.append(d);
Execution Count:2
2
444 } -
445 if (targetMargins.bottom() > 0 && targetMargins.left() > 0 && sourceMargins.bottom() > 0 && sourceMargins.left() > 0) {
partially evaluated: targetMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: targetMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
446 d.x = (0.5 * (xTarget[1] + xTarget[0])); -
447 d.y =(0.5 * (yTarget[rows] + yTarget[rows - 1])); -
448 d.sourceLeft = sourceRect.left(); -
449 d.sourceTop = sourceCenterBottom; -
450 d.width = sourceMargins.left(); -
451 d.height = sourceMargins.bottom(); -
452 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; -
453 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; -
454 if (hints & QDrawBorderPixmap::OpaqueBottomLeft)
partially evaluated: hints & QDrawBorderPixmap::OpaqueBottomLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
455 opaqueData.append(d);
never executed: opaqueData.append(d);
0
456 else -
457 translucentData.append(d);
executed: translucentData.append(d);
Execution Count:2
2
458 } -
459 if (targetMargins.bottom() > 0 && targetMargins.right() > 0 && sourceMargins.bottom() > 0 && sourceMargins.right() > 0) {
partially evaluated: targetMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: targetMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
460 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); -
461 d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); -
462 d.sourceLeft = sourceCenterRight; -
463 d.sourceTop = sourceCenterBottom; -
464 d.width = sourceMargins.right(); -
465 d.height = sourceMargins.bottom(); -
466 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; -
467 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; -
468 if (hints & QDrawBorderPixmap::OpaqueBottomRight)
partially evaluated: hints & QDrawBorderPixmap::OpaqueBottomRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
469 opaqueData.append(d);
never executed: opaqueData.append(d);
0
470 else -
471 translucentData.append(d);
executed: translucentData.append(d);
Execution Count:2
2
472 } -
473 -
474 -
475 if (targetCenterWidth > 0 && sourceCenterWidth > 0) {
evaluated: targetCenterWidth > 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: sourceCenterWidth > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
476 if (targetMargins.top() > 0 && sourceMargins.top() > 0) {
partially evaluated: targetMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: sourceMargins.top() > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
477 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop ? opaqueData : translucentData;
partially evaluated: hints & QDrawBorderPixmap::OpaqueTop
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
478 d.sourceLeft = sourceCenterLeft; -
479 d.sourceTop = sourceRect.top(); -
480 d.width = sourceCenterWidth; -
481 d.height = sourceMargins.top(); -
482 d.y = (0.5 * (yTarget[1] + yTarget[0])); -
483 d.scaleX = dx / d.width; -
484 d.scaleY = qreal(yTarget[1] - yTarget[0]) / d.height; -
485 for (int i = 1; i < columns - 1; ++i) {
evaluated: i < columns - 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
486 d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); -
487 data.append(d); -
488 }
executed: }
Execution Count:1
1
489 if (rules.horizontal == Qt::RepeatTile)
partially evaluated: rules.horizontal == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
490 data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
never executed: data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
0
491 }
executed: }
Execution Count:1
1
492 if (targetMargins.bottom() > 0 && sourceMargins.bottom() > 0) {
partially evaluated: targetMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: sourceMargins.bottom() > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
493 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom ? opaqueData : translucentData;
partially evaluated: hints & QDrawBorderPixmap::OpaqueBottom
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
494 d.sourceLeft = sourceCenterLeft; -
495 d.sourceTop = sourceCenterBottom; -
496 d.width = sourceCenterWidth; -
497 d.height = sourceMargins.bottom(); -
498 d.y = (0.5 * (yTarget[rows] + yTarget[rows - 1])); -
499 d.scaleX = dx / d.width; -
500 d.scaleY = qreal(yTarget[rows] - yTarget[rows - 1]) / d.height; -
501 for (int i = 1; i < columns - 1; ++i) {
evaluated: i < columns - 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
502 d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); -
503 data.append(d); -
504 }
executed: }
Execution Count:1
1
505 if (rules.horizontal == Qt::RepeatTile)
partially evaluated: rules.horizontal == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
506 data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
never executed: data[data.size() - 1].width = ((xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX);
0
507 }
executed: }
Execution Count:1
1
508 }
executed: }
Execution Count:1
1
509 -
510 -
511 if (targetCenterHeight > 0 && sourceCenterHeight > 0) {
partially evaluated: targetCenterHeight > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceCenterHeight > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
512 if (targetMargins.left() > 0 && sourceMargins.left() > 0) {
partially evaluated: targetMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.left() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
513 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft ? opaqueData : translucentData;
partially evaluated: hints & QDrawBorderPixmap::OpaqueLeft
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
514 d.sourceLeft = sourceRect.left(); -
515 d.sourceTop = sourceCenterTop; -
516 d.width = sourceMargins.left(); -
517 d.height = sourceCenterHeight; -
518 d.x = (0.5 * (xTarget[1] + xTarget[0])); -
519 d.scaleX = qreal(xTarget[1] - xTarget[0]) / d.width; -
520 d.scaleY = dy / d.height; -
521 for (int i = 1; i < rows - 1; ++i) {
evaluated: i < rows - 1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
522 d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); -
523 data.append(d); -
524 }
executed: }
Execution Count:2
2
525 if (rules.vertical == Qt::RepeatTile)
partially evaluated: rules.vertical == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
526 data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
never executed: data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
0
527 }
executed: }
Execution Count:2
2
528 if (targetMargins.right() > 0 && sourceMargins.right() > 0) {
partially evaluated: targetMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
partially evaluated: sourceMargins.right() > 0
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
529 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight ? opaqueData : translucentData;
partially evaluated: hints & QDrawBorderPixmap::OpaqueRight
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
530 d.sourceLeft = sourceCenterRight; -
531 d.sourceTop = sourceCenterTop; -
532 d.width = sourceMargins.right(); -
533 d.height = sourceCenterHeight; -
534 d.x = (0.5 * (xTarget[columns] + xTarget[columns - 1])); -
535 d.scaleX = qreal(xTarget[columns] - xTarget[columns - 1]) / d.width; -
536 d.scaleY = dy / d.height; -
537 for (int i = 1; i < rows - 1; ++i) {
evaluated: i < rows - 1
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:2
2
538 d.y = (0.5 * (yTarget[i + 1] + yTarget[i])); -
539 data.append(d); -
540 }
executed: }
Execution Count:2
2
541 if (rules.vertical == Qt::RepeatTile)
partially evaluated: rules.vertical == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
542 data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
never executed: data[data.size() - 1].height = ((yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY);
0
543 }
executed: }
Execution Count:2
2
544 }
executed: }
Execution Count:2
2
545 -
546 -
547 if (targetCenterWidth > 0 && targetCenterHeight > 0 && sourceCenterWidth > 0 && sourceCenterHeight > 0) {
evaluated: targetCenterWidth > 0
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
partially evaluated: targetCenterHeight > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: sourceCenterWidth > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
partially evaluated: sourceCenterHeight > 0
TRUEFALSE
yes
Evaluation Count:1
no
Evaluation Count:0
0-1
548 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter ? opaqueData : translucentData;
partially evaluated: hints & QDrawBorderPixmap::OpaqueCenter
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
549 d.sourceLeft = sourceCenterLeft; -
550 d.sourceTop = sourceCenterTop; -
551 d.width = sourceCenterWidth; -
552 d.height = sourceCenterHeight; -
553 d.scaleX = dx / d.width; -
554 d.scaleY = dy / d.height; -
555 -
556 qreal repeatWidth = (xTarget[columns - 1] - xTarget[columns - 2]) / d.scaleX; -
557 qreal repeatHeight = (yTarget[rows - 1] - yTarget[rows - 2]) / d.scaleY; -
558 -
559 for (int j = 1; j < rows - 1; ++j) {
evaluated: j < rows - 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
560 d.y = (0.5 * (yTarget[j + 1] + yTarget[j])); -
561 for (int i = 1; i < columns - 1; ++i) {
evaluated: i < columns - 1
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1
1
562 d.x = (0.5 * (xTarget[i + 1] + xTarget[i])); -
563 data.append(d); -
564 }
executed: }
Execution Count:1
1
565 if (rules.horizontal == Qt::RepeatTile)
partially evaluated: rules.horizontal == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
566 data[data.size() - 1].width = repeatWidth;
never executed: data[data.size() - 1].width = repeatWidth;
0
567 }
executed: }
Execution Count:1
1
568 if (rules.vertical == Qt::RepeatTile) {
partially evaluated: rules.vertical == Qt::RepeatTile
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
569 for (int i = 1; i < columns - 1; ++i)
never evaluated: i < columns - 1
0
570 data[data.size() - i].height = repeatHeight;
never executed: data[data.size() - i].height = repeatHeight;
0
571 }
never executed: }
0
572 }
executed: }
Execution Count:1
1
573 -
574 if (opaqueData.size())
partially evaluated: opaqueData.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
575 painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint);
never executed: painter->drawPixmapFragments(opaqueData.data(), opaqueData.size(), pixmap, QPainter::OpaqueHint);
0
576 if (translucentData.size())
partially evaluated: translucentData.size()
TRUEFALSE
yes
Evaluation Count:2
no
Evaluation Count:0
0-2
577 painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
executed: painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
Execution Count:2
2
578 -
579 if (oldAA)
partially evaluated: oldAA
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
580 painter->setRenderHint(QPainter::Antialiasing, true);
never executed: painter->setRenderHint(QPainter::Antialiasing, true);
0
581}
executed: }
Execution Count:2
2
582 -
583 -
584 -
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial