qdrawutil.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qdrawutil.cpp
Switch to Source codePreprocessed file
LineSourceCount
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 (__builtin_expect(!!(!p || lineWidth < 0 || midLineWidth < 0), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
8 QMessageLogger(__FILE__, 97, __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
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
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
y1 == y2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
20 int y = y1 - tlw/2;-
21 if (x1 > x2
x1 > x2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
22 int t = x1;-
23 x1 = x2;-
24 x2 = t;-
25 }
never executed: end of block
0
26 x2--;-
27 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
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: end of block
0
33 if (midLineWidth > 0
midLineWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
34 p->setPen(pal.mid().color());-
35 for (i=0; i<midLineWidth
i<midLineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
36 p->drawLine(x1+lineWidth, y+lineWidth+i,
never executed: p->drawLine(x1+lineWidth, y+lineWidth+i, x2-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: end of block
0
39 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
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<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
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: end of block
0
49 }
never executed: end of block
0
50 else if (x1 == x2
x1 == x2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
51 int x = x1 - tlw/2;-
52 if (y1 > y2
y1 > y2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
53 int t = y1;-
54 y1 = y2;-
55 y2 = t;-
56 }
never executed: end of block
0
57 y2--;-
58 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
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: end of block
0
64 if (midLineWidth > 0
midLineWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 p->setPen(pal.mid().color());-
66 for (i=0; i<midLineWidth
i<midLineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++)
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: end of block
0
69 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
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<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
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: end of block
0
79 }
never executed: end of block
0
80 p->setPen(oldPen);-
81}
never executed: end of block
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
w == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h == 0
h == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
88 return;
never executed: return;
0
89 if (__builtin_expect(!!(w < 0 || h < 0 || lineWidth < 0 || midLineWidth < 0), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
90 QMessageLogger(__FILE__, 213, __PRETTY_FUNCTION__).warning("qDrawShadeRect: Invalid parameters");-
91 return;
never executed: return;
0
92 }-
93 QPen oldPen = p->pen();-
94 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
95 p->setPen(pal.dark().color());
never executed: p->setPen(pal.dark().color());
0
96 else-
97 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
98 int x1=x, y1=y, x2=x+w-1, y2=y+h-1;-
99-
100 if (lineWidth == 1
lineWidth == 1Description
TRUEnever evaluated
FALSEnever evaluated
&& midLineWidth == 0
midLineWidth == 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 p->drawRect(x1, y1, w-2, h-2);-
102 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
103 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
104 else-
105 p->setPen(pal.dark().color());
never executed: p->setPen(pal.dark().color());
0
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 }
never executed: end of block
else {
0
112 int m = lineWidth+midLineWidth;-
113 int i, j=0, k=m;-
114 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
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: end of block
0
122 p->setPen(pal.mid().color());-
123 j = lineWidth*2;-
124 for (i=0; i<midLineWidth
i<midLineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
125 p->drawRect(x1+lineWidth+i, y1+lineWidth+i, w-j-1, h-j-1);-
126 j += 2;-
127 }
never executed: end of block
0
128 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
129 p->setPen(pal.light().color());
never executed: p->setPen(pal.light().color());
0
130 else-
131 p->setPen(pal.dark().color());
never executed: p->setPen(pal.dark().color());
0
132 k = m;-
133 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
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: end of block
0
141 }
never executed: end of block
0
142 if (fill
fillDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
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 }
never executed: end of block
0
150 p->setPen(oldPen);-
151}
never executed: end of block
0
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
w == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h == 0
h == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
157 return;
never executed: return;
0
158 if (__builtin_expect(!!(w < 0 || h < 0 || lineWidth < 0), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
159 QMessageLogger(__FILE__, 313, __PRETTY_FUNCTION__).warning("qDrawShadePanel: Invalid parameters");-
160 }
never executed: end of block
0
161 QColor shade = pal.dark().color();-
162 QColor light = pal.light().color();-
163 if (fill
fillDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
164 if (fill->color() == shade
fill->color() == shadeDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
165 shade = pal.shadow().color();
never executed: shade = pal.shadow().color();
0
166 if (fill->color() == light
fill->color() == lightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
167 light = pal.midlight().color();
never executed: light = pal.midlight().color();
0
168 }
never executed: end of block
0
169 QPen oldPen = p->pen();-
170 QVector<QLineF> lines;-
171 lines.reserve(2*lineWidth);-
172-
173 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
174 p->setPen(shade);
never executed: p->setPen(shade);
0
175 else-
176 p->setPen(light);
never executed: p->setPen(light);
0
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<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
183 lines << QLineF(x1, y1++, x2--, y2++);-
184 }
never executed: end of block
0
185 x2 = x1;-
186 y1 = y+h-2;-
187 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
188 lines << QLineF(x1++, y1, x2++, y2--);-
189 }
never executed: end of block
0
190 p->drawLines(lines);-
191 lines.clear();-
192 if (sunken
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
193 p->setPen(light);
never executed: p->setPen(light);
0
194 else-
195 p->setPen(shade);
never executed: p->setPen(shade);
0
196 x1 = x;-
197 y1 = y2 = y+h-1;-
198 x2 = x+w-1;-
199 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
200 lines << QLineF(x1++, y1--, x2, y2--);-
201 }
never executed: end of block
0
202 x1 = x2;-
203 y1 = y;-
204 y2 = y+h-lineWidth-1;-
205 for (i=0; i<lineWidth
i<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++) {
0
206 lines << QLineF(x1--, y1++, x2--, y2);-
207 }
never executed: end of block
0
208 p->drawLines(lines);-
209 if (fill
fillDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
210 p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
never executed: p->fillRect(x+lineWidth, y+lineWidth, w-lineWidth*2, h-lineWidth*2, *fill);
0
211 p->setPen(oldPen);-
212}
never executed: end of block
0
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
w < 2Description
TRUEnever evaluated
FALSEnever evaluated
|| h < 2
h < 2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
220 return;
never executed: return;
0
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
w > 4Description
TRUEnever evaluated
FALSEnever evaluated
&& h > 4
h > 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
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
fillDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
236 p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
never executed: p->fillRect(QRect(x+2, y+2, w-4, h-4), *fill);
0
237 }
never executed: end of block
0
238 p->setPen(oldPen);-
239}
never executed: end of block
0
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
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
245 qDrawWinShades(p, x, y, w, h,
never executed: qDrawWinShades(p, x, y, w, h, pal.shadow().color(), pal.light().color(), pal.dark().color(), pal.button().color(), fill);
0
246 pal.shadow().color(), pal.light().color(), pal.dark().color(),
never executed: qDrawWinShades(p, x, y, w, h, pal.shadow().color(), pal.light().color(), pal.dark().color(), pal.button().color(), fill);
0
247 pal.button().color(), fill);
never executed: qDrawWinShades(p, x, y, w, h, pal.shadow().color(), pal.light().color(), pal.dark().color(), pal.button().color(), fill);
0
248 else-
249 qDrawWinShades(p, x, y, w, h,
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.button().color(), pal.dark().color(), fill);
0
250 pal.light().color(), pal.shadow().color(), pal.button().color(),
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.button().color(), pal.dark().color(), fill);
0
251 pal.dark().color(), fill);
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.button().color(), pal.dark().color(), fill);
0
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
sunkenDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
258 qDrawWinShades(p, x, y, w, h,
never executed: qDrawWinShades(p, x, y, w, h, pal.dark().color(), pal.light().color(), pal.shadow().color(), pal.midlight().color(), fill);
0
259 pal.dark().color(), pal.light().color(), pal.shadow().color(),
never executed: qDrawWinShades(p, x, y, w, h, pal.dark().color(), pal.light().color(), pal.shadow().color(), pal.midlight().color(), fill);
0
260 pal.midlight().color(), fill);
never executed: qDrawWinShades(p, x, y, w, h, pal.dark().color(), pal.light().color(), pal.shadow().color(), pal.midlight().color(), fill);
0
261 else-
262 qDrawWinShades(p, x, y, w, h,
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.midlight().color(), pal.dark().color(), fill);
0
263 pal.light().color(), pal.shadow().color(), pal.midlight().color(),
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.midlight().color(), pal.dark().color(), fill);
0
264 pal.dark().color(), fill);
never executed: qDrawWinShades(p, x, y, w, h, pal.light().color(), pal.shadow().color(), pal.midlight().color(), pal.dark().color(), fill);
0
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
w == 0Description
TRUEnever evaluated
FALSEnever evaluated
|| h == 0
h == 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
270 return;
never executed: return;
0
271 if (__builtin_expect(!!(w < 0 || h < 0 || lineWidth < 0), false)
__builtin_expe...h < 0), false)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
272 QMessageLogger(__FILE__, 519, __PRETTY_FUNCTION__).warning("qDrawPlainRect: Invalid parameters");-
273 }
never executed: end of block
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<lineWidthDescription
TRUEnever evaluated
FALSEnever evaluated
; i++)
0
279 p->drawRect(x+i, y+i, w-i*2 - 1, h-i*2 - 1);
never executed: p->drawRect(x+i, y+i, w-i*2 - 1, h-i*2 - 1);
0
280 if (fill
fillDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
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: end of block
0
285 p->setPen(oldPen);-
286 p->setBrush(oldBrush);-
287}
never executed: end of block
0
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: end of block
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}
never executed: end of block
0
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}
never executed: end of block
0
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}
never executed: end of block
0
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}
never executed: end of block
0
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}
never executed: end of block
0
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
rules.horizont...t::StretchTileDescription
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterWidth != 0
sourceCenterWidth != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
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
rules.vertical...t::StretchTileDescription
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterHeight != 0
sourceCenterHeight != 0Description
TRUEnever evaluated
FALSEnever evaluated
)
0
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
painter->paint...Engine::OpenGLDescription
TRUEnever evaluated
FALSEnever evaluated
0
368 && painter->paintEngine()->type() != QPaintEngine::OpenGL2
painter->paint...ngine::OpenGL2Description
TRUEnever evaluated
FALSEnever evaluated
0
369 && oldAA
oldAADescription
TRUEnever evaluated
FALSEnever evaluated
&& painter->combinedTransform().type() != QTransform::TxNone
painter->combi...nsform::TxNoneDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
370 painter->setRenderHint(QPainter::Antialiasing, false);-
371 }
never executed: end of block
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
never executed: case Qt::StretchTile:
Qt::StretchTile:
never executed: case Qt::StretchTile:
0
388 dx = targetCenterWidth;-
389 break;
never executed: break;
0
390 case
never executed: case Qt::RepeatTile:
Qt::RepeatTile:
never executed: case Qt::RepeatTile:
0
391 dx = sourceCenterWidth;-
392 break;
never executed: break;
0
393 case
never executed: case Qt::RoundTile:
Qt::RoundTile:
never executed: case Qt::RoundTile:
0
394 dx = targetCenterWidth / qreal(columns - 2);-
395 break;
never executed: break;
0
396 }-
397-
398 for (int i = 2; i < columns - 1
i < columns - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
399 xTarget[i] = xTarget[i - 1] + dx;
never executed: xTarget[i] = xTarget[i - 1] + dx;
0
400-
401 switch (rules.vertical) {-
402 case
never executed: case Qt::StretchTile:
Qt::StretchTile:
never executed: case Qt::StretchTile:
0
403 dy = targetCenterHeight;-
404 break;
never executed: break;
0
405 case
never executed: case Qt::RepeatTile:
Qt::RepeatTile:
never executed: case Qt::RepeatTile:
0
406 dy = sourceCenterHeight;-
407 break;
never executed: break;
0
408 case
never executed: case Qt::RoundTile:
Qt::RoundTile:
never executed: case Qt::RoundTile:
0
409 dy = targetCenterHeight / qreal(rows - 2);-
410 break;
never executed: break;
0
411 }-
412-
413 for (int i = 2; i < rows - 1
i < rows - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
414 yTarget[i] = yTarget[i - 1] + dy;
never executed: yTarget[i] = yTarget[i - 1] + dy;
0
415-
416-
417 if (targetMargins.top() > 0
targetMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& targetMargins.left() > 0
targetMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.top() > 0
sourceMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.left() > 0
sourceMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
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
hints & QDrawB...:OpaqueTopLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
427 opaqueData.append(d);
never executed: opaqueData.append(d);
0
428 else-
429 translucentData.append(d);
never executed: translucentData.append(d);
0
430 }-
431 if (targetMargins.top() > 0
targetMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& targetMargins.right() > 0
targetMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.top() > 0
sourceMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.right() > 0
sourceMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
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
hints & QDrawB...OpaqueTopRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
441 opaqueData.append(d);
never executed: opaqueData.append(d);
0
442 else-
443 translucentData.append(d);
never executed: translucentData.append(d);
0
444 }-
445 if (targetMargins.bottom() > 0
targetMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& targetMargins.left() > 0
targetMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.bottom() > 0
sourceMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.left() > 0
sourceMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
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
hints & QDrawB...aqueBottomLeftDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
455 opaqueData.append(d);
never executed: opaqueData.append(d);
0
456 else-
457 translucentData.append(d);
never executed: translucentData.append(d);
0
458 }-
459 if (targetMargins.bottom() > 0
targetMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& targetMargins.right() > 0
targetMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.bottom() > 0
sourceMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.right() > 0
sourceMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
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
hints & QDrawB...queBottomRightDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
469 opaqueData.append(d);
never executed: opaqueData.append(d);
0
470 else-
471 translucentData.append(d);
never executed: translucentData.append(d);
0
472 }-
473-
474-
475 if (targetCenterWidth > 0
targetCenterWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterWidth > 0
sourceCenterWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
476 if (targetMargins.top() > 0
targetMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.top() > 0
sourceMargins.top() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
477 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueTop
hints & QDrawB...map::OpaqueTopDescription
TRUEnever evaluated
FALSEnever evaluated
? opaqueData : translucentData;
0
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 < columns - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
486 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));-
487 data.append(d);-
488 }
never executed: end of block
0
489 if (rules.horizontal == Qt::RepeatTile
rules.horizont...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
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 }
never executed: end of block
0
492 if (targetMargins.bottom() > 0
targetMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.bottom() > 0
sourceMargins.bottom() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
493 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueBottom
hints & QDrawB...::OpaqueBottomDescription
TRUEnever evaluated
FALSEnever evaluated
? opaqueData : translucentData;
0
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 < columns - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
502 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));-
503 data.append(d);-
504 }
never executed: end of block
0
505 if (rules.horizontal == Qt::RepeatTile
rules.horizont...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
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 }
never executed: end of block
0
508 }
never executed: end of block
0
509-
510-
511 if (targetCenterHeight > 0
targetCenterHeight > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterHeight > 0
sourceCenterHeight > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
512 if (targetMargins.left() > 0
targetMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.left() > 0
sourceMargins.left() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
513 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueLeft
hints & QDrawB...ap::OpaqueLeftDescription
TRUEnever evaluated
FALSEnever evaluated
? opaqueData : translucentData;
0
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 < rows - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
522 d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));-
523 data.append(d);-
524 }
never executed: end of block
0
525 if (rules.vertical == Qt::RepeatTile
rules.vertical...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
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 }
never executed: end of block
0
528 if (targetMargins.right() > 0
targetMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceMargins.right() > 0
sourceMargins.right() > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
529 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueRight
hints & QDrawB...p::OpaqueRightDescription
TRUEnever evaluated
FALSEnever evaluated
? opaqueData : translucentData;
0
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 < rows - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
538 d.y = (0.5 * (yTarget[i + 1] + yTarget[i]));-
539 data.append(d);-
540 }
never executed: end of block
0
541 if (rules.vertical == Qt::RepeatTile
rules.vertical...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
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 }
never executed: end of block
0
544 }
never executed: end of block
0
545-
546-
547 if (targetCenterWidth > 0
targetCenterWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& targetCenterHeight > 0
targetCenterHeight > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterWidth > 0
sourceCenterWidth > 0Description
TRUEnever evaluated
FALSEnever evaluated
&& sourceCenterHeight > 0
sourceCenterHeight > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
548 QPixmapFragmentsArray &data = hints & QDrawBorderPixmap::OpaqueCenter
hints & QDrawB...::OpaqueCenterDescription
TRUEnever evaluated
FALSEnever evaluated
? opaqueData : translucentData;
0
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 < rows - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++j) {
0
560 d.y = (0.5 * (yTarget[j + 1] + yTarget[j]));-
561 for (int i = 1; i < columns - 1
i < columns - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
562 d.x = (0.5 * (xTarget[i + 1] + xTarget[i]));-
563 data.append(d);-
564 }
never executed: end of block
0
565 if (rules.horizontal == Qt::RepeatTile
rules.horizont...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
566 data[data.size() - 1].width = repeatWidth;
never executed: data[data.size() - 1].width = repeatWidth;
0
567 }
never executed: end of block
0
568 if (rules.vertical == Qt::RepeatTile
rules.vertical...Qt::RepeatTileDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
569 for (int i = 1; i < columns - 1
i < columns - 1Description
TRUEnever evaluated
FALSEnever evaluated
; ++i)
0
570 data[data.size() - i].height = repeatHeight;
never executed: data[data.size() - i].height = repeatHeight;
0
571 }
never executed: end of block
0
572 }
never executed: end of block
0
573-
574 if (opaqueData.size()
opaqueData.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
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()
translucentData.size()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
577 painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
never executed: painter->drawPixmapFragments(translucentData.data(), translucentData.size(), pixmap);
0
578-
579 if (oldAA
oldAADescription
TRUEnever evaluated
FALSEnever evaluated
)
0
580 painter->setRenderHint(QPainter::Antialiasing, true);
never executed: painter->setRenderHint(QPainter::Antialiasing, true);
0
581}
never executed: end of block
0
582-
583-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9