kernel/qwidgetbackingstore.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -
4** Contact: http://www.qt-project.org/legal -
5** -
6** This file is part of the QtGui module of the Qt Toolkit. -
7** -
8** $QT_BEGIN_LICENSE:LGPL$ -
9** Commercial License Usage -
10** Licensees holding valid commercial Qt licenses may use this file in -
11** accordance with the commercial license agreement provided with the -
12** Software or, alternatively, in accordance with the terms contained in -
13** a written agreement between you and Digia. For licensing terms and -
14** conditions see http://qt.digia.com/licensing. For further information -
15** use the contact form at http://qt.digia.com/contact-us. -
16** -
17** GNU Lesser General Public License Usage -
18** Alternatively, this file may be used under the terms of the GNU Lesser -
19** General Public License version 2.1 as published by the Free Software -
20** Foundation and appearing in the file LICENSE.LGPL included in the -
21** packaging of this file. Please review the following information to -
22** ensure the GNU Lesser General Public License version 2.1 requirements -
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -
24** -
25** In addition, as a special exception, Digia gives you certain additional -
26** rights. These rights are described in the Digia Qt LGPL Exception -
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -
28** -
29** GNU General Public License Usage -
30** Alternatively, this file may be used under the terms of the GNU -
31** General Public License version 3.0 as published by the Free Software -
32** Foundation and appearing in the file LICENSE.GPL included in the -
33** packaging of this file. Please review the following information to -
34** ensure the GNU General Public License version 3.0 requirements will be -
35** met: http://www.gnu.org/copyleft/gpl.html. -
36** -
37** -
38** $QT_END_LICENSE$ -
39** -
40****************************************************************************/ -
41 -
42 -
43#include "qplatformdefs.h" -
44 -
45#include "qwidgetbackingstore_p.h" -
46 -
47#include <QtCore/qglobal.h> -
48#include <QtCore/qdebug.h> -
49#include <QtCore/qvarlengtharray.h> -
50#include <QtGui/qevent.h> -
51#include <QtWidgets/qapplication.h> -
52#include <QtGui/qpaintengine.h> -
53#include <QtWidgets/qgraphicsproxywidget.h> -
54 -
55#include <private/qwidget_p.h> -
56#include <private/qapplication_p.h> -
57#include <private/qpaintengine_raster_p.h> -
58#include <private/qgraphicseffect_p.h> -
59 -
60#if defined(Q_OS_WIN) && !defined(QT_NO_PAINT_DEBUG) -
61# include <QtCore/qt_windows.h> -
62# include <qpa/qplatformnativeinterface.h> -
63#endif -
64 -
65QT_BEGIN_NAMESPACE -
66 -
67extern QRegion qt_dirtyRegion(QWidget *); -
68 -
69/* -
70 A version of QRect::intersects() that does not normalize the rects. -
71*/ -
72static inline bool qRectIntersects(const QRect &r1, const QRect &r2) -
73{ -
74 return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right())
never executed: return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
0
75 && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
never executed: return (qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()));
0
76} -
77 -
78/** -
79 * Flushes the contents of the \a backingStore into the screen area of \a widget. -
80 * \a tlwOffset is the position of the top level widget relative to the window surface. -
81 * \a region is the region to be updated in \a widget coordinates. -
82 */ -
83static inline void qt_flush(QWidget *widget, const QRegion &region, QBackingStore *backingStore, -
84 QWidget *tlw, const QPoint &tlwOffset) -
85{ -
86 Q_ASSERT(widget);
executed (the execution status of this line is deduced): qt_noop();
-
87 Q_ASSERT(!region.isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
88 Q_ASSERT(backingStore);
executed (the execution status of this line is deduced): qt_noop();
-
89 Q_ASSERT(tlw);
executed (the execution status of this line is deduced): qt_noop();
-
90 -
91#if !defined(QT_NO_PAINT_DEBUG) -
92 static int flushUpdate = qgetenv("QT_FLUSH_UPDATE").toInt(); -
93 if (flushUpdate > 0) -
94 QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); -
95#endif -
96 -
97 //The performance hit by doing this should be negligible. However, be aware that -
98 //using this FPS when you have > 1 windowsurface can give you inaccurate FPS -
99 static bool fpsDebug = qgetenv("QT_DEBUG_FPS").toInt(); -
100 if (fpsDebug) {
partially evaluated: fpsDebug
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8021
0-8021
101 static QTime time = QTime::currentTime(); -
102 static int frames = 0; -
103 -
104 frames++;
never executed (the execution status of this line is deduced): frames++;
-
105 -
106 if(time.elapsed() > 5000) {
never evaluated: time.elapsed() > 5000
0
107 double fps = double(frames * 1000) /time.restart();
never executed (the execution status of this line is deduced): double fps = double(frames * 1000) /time.restart();
-
108 fprintf(stderr,"FPS: %.1f\n",fps);
never executed (the execution status of this line is deduced): fprintf(stderr,"FPS: %.1f\n",fps);
-
109 frames = 0;
never executed (the execution status of this line is deduced): frames = 0;
-
110 }
never executed: }
0
111 }
never executed: }
0
112 -
113 if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))
evaluated: tlw->testAttribute(Qt::WA_DontShowOnScreen)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:8020
partially evaluated: widget->testAttribute(Qt::WA_DontShowOnScreen)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8020
0-8020
114 return;
executed: return;
Execution Count:1
1
115 -
116 if (widget != tlw)
evaluated: widget != tlw
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:7997
23-7997
117 backingStore->flush(region, widget->windowHandle(), tlwOffset + widget->mapTo(tlw, QPoint()));
executed: backingStore->flush(region, widget->windowHandle(), tlwOffset + widget->mapTo(tlw, QPoint()));
Execution Count:23
23
118 else -
119 backingStore->flush(region, widget->windowHandle(), tlwOffset);
executed: backingStore->flush(region, widget->windowHandle(), tlwOffset);
Execution Count:7997
7997
120} -
121 -
122#ifndef QT_NO_PAINT_DEBUG -
123#ifdef Q_OS_WIN -
124 -
125static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec) -
126{ -
127 // We expect to be passed a native parent. -
128 QWindow *nativeWindow = widget->windowHandle(); -
129 if (!nativeWindow) -
130 return; -
131 void *hdcV = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("getDC"), nativeWindow); -
132 if (!hdcV) -
133 return; -
134 const HDC hdc = reinterpret_cast<HDC>(hdcV); -
135 -
136 HBRUSH brush; -
137 static int i = 0; -
138 switch (i) { -
139 case 0: -
140 brush = CreateSolidBrush(RGB(255, 255, 0)); -
141 break; -
142 case 1: -
143 brush = CreateSolidBrush(RGB(255, 200, 55)); -
144 break; -
145 case 2: -
146 brush = CreateSolidBrush(RGB(200, 255, 55)); -
147 break; -
148 case 3: -
149 brush = CreateSolidBrush(RGB(200, 200, 0)); -
150 break; -
151 } -
152 i = (i + 1) & 3; -
153 -
154 foreach (const QRect &rect, region.rects()) { -
155 RECT winRect; -
156 SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); -
157 FillRect(hdc, &winRect, brush); -
158 } -
159 DeleteObject(brush); -
160 QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), nativeWindow); -
161 ::Sleep(msec); -
162} -
163#endif // Q_OS_WIN -
164 -
165void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) -
166{ -
167 QRegion paintRegion = toBePainted; -
168 QRect widgetRect = widget->rect(); -
169 -
170 if (!widget->internalWinId()) { -
171 QWidget *nativeParent = widget->nativeParentWidget(); -
172 const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); -
173 paintRegion.translate(offset); -
174 widgetRect.translate(offset); -
175 widget = nativeParent; -
176 } -
177 -
178#ifdef Q_OS_WIN -
179 Q_UNUSED(unclipped); -
180 showYellowThing_win(widget, paintRegion, msec); -
181#else -
182 //flags to fool painter -
183 bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped); -
184 if (unclipped && !widget->d_func()->paintOnScreen()) -
185 widget->setAttribute(Qt::WA_PaintUnclipped); -
186 -
187 const bool setFlag = !widget->testAttribute(Qt::WA_WState_InPaintEvent); -
188 if (setFlag) -
189 widget->setAttribute(Qt::WA_WState_InPaintEvent); -
190 -
191 //setup the engine -
192 QPaintEngine *pe = widget->paintEngine(); -
193 if (pe) { -
194 pe->setSystemClip(paintRegion); -
195 { -
196 QPainter p(widget); -
197 p.setClipRegion(paintRegion); -
198 static int i = 0; -
199 switch (i) { -
200 case 0: -
201 p.fillRect(widgetRect, QColor(255,255,0)); -
202 break; -
203 case 1: -
204 p.fillRect(widgetRect, QColor(255,200,55)); -
205 break; -
206 case 2: -
207 p.fillRect(widgetRect, QColor(200,255,55)); -
208 break; -
209 case 3: -
210 p.fillRect(widgetRect, QColor(200,200,0)); -
211 break; -
212 } -
213 i = (i+1) & 3; -
214 p.end(); -
215 } -
216 } -
217 -
218 if (setFlag) -
219 widget->setAttribute(Qt::WA_WState_InPaintEvent, false); -
220 -
221 //restore -
222 widget->setAttribute(Qt::WA_PaintUnclipped, paintUnclipped); -
223 -
224 if (pe) -
225 pe->setSystemClip(QRegion()); -
226 -
227#if defined(Q_OS_UNIX) -
228 ::usleep(1000 * msec); -
229#endif -
230#endif // !Q_OS_WIN -
231} -
232 -
233bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) -
234{ -
235 if (!widget) -
236 return false; -
237 -
238 int delay = 0; -
239 if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) { -
240 static int flushPaintEvent = qgetenv("QT_FLUSH_PAINT_EVENT").toInt(); -
241 if (!flushPaintEvent) -
242 return false; -
243 delay = flushPaintEvent; -
244 } else { -
245 static int flushPaint = qgetenv("QT_FLUSH_PAINT").toInt(); -
246 if (!flushPaint) -
247 return false; -
248 delay = flushPaint; -
249 } -
250 -
251 QWidgetBackingStore::showYellowThing(widget, rgn, delay * 10, true); -
252 return true; -
253} -
254 -
255void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) -
256{ -
257 if (widget->d_func()->paintOnScreen() || rgn.isEmpty()) -
258 return; -
259 -
260 QWidget *tlw = widget->window(); -
261 QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); -
262 if (!tlwExtra) -
263 return; -
264 -
265 const QPoint offset = widget->mapTo(tlw, QPoint()); -
266 qt_flush(widget, rgn, tlwExtra->backingStoreTracker->store, tlw, offset); -
267} -
268#endif // QT_NO_PAINT_DEBUG -
269 -
270/* -
271 Moves the whole rect by (dx, dy) in widget's coordinate system. -
272 Doesn't generate any updates. -
273*/ -
274bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) -
275{ -
276 const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
executed (the execution status of this line is deduced): const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft()));
-
277 const QRect tlwRect(QRect(pos, rect.size()));
executed (the execution status of this line is deduced): const QRect tlwRect(QRect(pos, rect.size()));
-
278 if (fullUpdatePending || dirty.intersects(tlwRect))
partially evaluated: fullUpdatePending
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13142
evaluated: dirty.intersects(tlwRect)
TRUEFALSE
yes
Evaluation Count:11167
yes
Evaluation Count:1975
0-13142
279 return false; // We don't want to scroll junk.
executed: return false;
Execution Count:11167
11167
280 return store->scroll(tlwRect, dx, dy);
executed: return store->scroll(tlwRect, dx, dy);
Execution Count:1975
1975
281} -
282 -
283void QWidgetBackingStore::releaseBuffer() -
284{ -
285 if (store)
never evaluated: store
0
286 store->resize(QSize());
never executed: store->resize(QSize());
0
287}
never executed: }
0
288 -
289/*! -
290 Prepares the window surface to paint a\ toClean region of the \a widget and -
291 updates the BeginPaintInfo struct accordingly. -
292 -
293 The \a toClean region might be clipped by the window surface. -
294*/ -
295void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, -
296 BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates) -
297{ -
298 Q_UNUSED(widget);
executed (the execution status of this line is deduced): (void)widget;;
-
299 Q_UNUSED(toCleanIsInTopLevelCoordinates);
executed (the execution status of this line is deduced): (void)toCleanIsInTopLevelCoordinates;;
-
300 -
301 // Always flush repainted areas. -
302 dirtyOnScreen += toClean;
executed (the execution status of this line is deduced): dirtyOnScreen += toClean;
-
303 -
304#ifdef QT_NO_PAINT_DEBUG -
305 backingStore->beginPaint(toClean);
executed (the execution status of this line is deduced): backingStore->beginPaint(toClean);
-
306#else -
307 returnInfo->wasFlushed = QWidgetBackingStore::flushPaint(tlw, toClean); -
308 // Avoid deadlock with QT_FLUSH_PAINT: the server will wait for -
309 // the BackingStore lock, so if we hold that, the server will -
310 // never release the Communication lock that we are waiting for in -
311 // sendSynchronousCommand -
312 if (!returnInfo->wasFlushed) -
313 backingStore->beginPaint(toClean); -
314#endif -
315 -
316 Q_UNUSED(returnInfo);
executed (the execution status of this line is deduced): (void)returnInfo;;
-
317}
executed: }
Execution Count:6183
6183
318 -
319void QWidgetBackingStore::endPaint(const QRegion &cleaned, QBackingStore *backingStore, -
320 BeginPaintInfo *beginPaintInfo) -
321{ -
322#ifndef QT_NO_PAINT_DEBUG -
323 if (!beginPaintInfo->wasFlushed) -
324 backingStore->endPaint(); -
325 else -
326 QWidgetBackingStore::unflushPaint(tlw, cleaned); -
327#else -
328 Q_UNUSED(beginPaintInfo);
executed (the execution status of this line is deduced): (void)beginPaintInfo;;
-
329 Q_UNUSED(cleaned);
executed (the execution status of this line is deduced): (void)cleaned;;
-
330 backingStore->endPaint();
executed (the execution status of this line is deduced): backingStore->endPaint();
-
331#endif -
332 -
333 flush();
executed (the execution status of this line is deduced): flush();
-
334}
executed: }
Execution Count:6183
6183
335 -
336/*! -
337 Returns the region (in top-level coordinates) that needs repaint and/or flush. -
338 -
339 If the widget is non-zero, only the dirty region for the widget is returned -
340 and the region will be in widget coordinates. -
341*/ -
342QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const -
343{ -
344 const bool widgetDirty = widget && widget != tlw;
never evaluated: widget
never evaluated: widget != tlw
0
345 const QRect tlwRect(topLevelRect());
never executed (the execution status of this line is deduced): const QRect tlwRect(topLevelRect());
-
346 const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
never executed (the execution status of this line is deduced): const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
-
347 if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {
never evaluated: fullUpdatePending
never evaluated: surfaceGeometry != tlwRect
never evaluated: surfaceGeometry.size() != tlwRect.size()
0
348 if (widgetDirty) {
never evaluated: widgetDirty
0
349 const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
never executed (the execution status of this line is deduced): const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size());
-
350 const QPoint offset(widget->mapTo(tlw, QPoint()));
never executed (the execution status of this line is deduced): const QPoint offset(widget->mapTo(tlw, QPoint()));
-
351 const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset));
never executed (the execution status of this line is deduced): const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset));
-
352 return dirtyWidgetRect.translated(-offset);
never executed: return dirtyWidgetRect.translated(-offset);
0
353 } -
354 return QRect(QPoint(), tlwRect.size());
never executed: return QRect(QPoint(), tlwRect.size());
0
355 } -
356 -
357 // Calculate the region that needs repaint. -
358 QRegion r(dirty);
never executed (the execution status of this line is deduced): QRegion r(dirty);
-
359 for (int i = 0; i < dirtyWidgets.size(); ++i) {
never evaluated: i < dirtyWidgets.size()
0
360 QWidget *w = dirtyWidgets.at(i);
never executed (the execution status of this line is deduced): QWidget *w = dirtyWidgets.at(i);
-
361 if (widgetDirty && w != widget && !widget->isAncestorOf(w))
never evaluated: widgetDirty
never evaluated: w != widget
never evaluated: !widget->isAncestorOf(w)
0
362 continue;
never executed: continue;
0
363 r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint()));
never executed (the execution status of this line is deduced): r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint()));
-
364 }
never executed: }
0
365 -
366 // Append the region that needs flush. -
367 r += dirtyOnScreen;
never executed (the execution status of this line is deduced): r += dirtyOnScreen;
-
368 -
369 if (dirtyOnScreenWidgets) { // Only in use with native child widgets.
never evaluated: dirtyOnScreenWidgets
0
370 for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {
never evaluated: i < dirtyOnScreenWidgets->size()
0
371 QWidget *w = dirtyOnScreenWidgets->at(i);
never executed (the execution status of this line is deduced): QWidget *w = dirtyOnScreenWidgets->at(i);
-
372 if (widgetDirty && w != widget && !widget->isAncestorOf(w))
never evaluated: widgetDirty
never evaluated: w != widget
never evaluated: !widget->isAncestorOf(w)
0
373 continue;
never executed: continue;
0
374 QWidgetPrivate *wd = w->d_func();
never executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
375 Q_ASSERT(wd->needsFlush);
never executed (the execution status of this line is deduced): qt_noop();
-
376 r += wd->needsFlush->translated(w->mapTo(tlw, QPoint()));
never executed (the execution status of this line is deduced): r += wd->needsFlush->translated(w->mapTo(tlw, QPoint()));
-
377 }
never executed: }
0
378 }
never executed: }
0
379 -
380 if (widgetDirty) {
never evaluated: widgetDirty
0
381 // Intersect with the widget geometry and translate to its coordinates. -
382 const QPoint offset(widget->mapTo(tlw, QPoint()));
never executed (the execution status of this line is deduced): const QPoint offset(widget->mapTo(tlw, QPoint()));
-
383 r &= widget->rect().translated(offset);
never executed (the execution status of this line is deduced): r &= widget->rect().translated(offset);
-
384 r.translate(-offset);
never executed (the execution status of this line is deduced): r.translate(-offset);
-
385 }
never executed: }
0
386 return r;
never executed: return r;
0
387} -
388 -
389/*! -
390 Returns the static content inside the \a parent if non-zero; otherwise the static content -
391 for the entire backing store is returned. The content will be clipped to \a withinClipRect -
392 if non-empty. -
393*/ -
394QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const -
395{ -
396 if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {
partially evaluated: !parent
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3338
never evaluated: tlw->testAttribute(Qt::WA_StaticContents)
0-3338
397 const QSize surfaceGeometry(store->size());
never executed (the execution status of this line is deduced): const QSize surfaceGeometry(store->size());
-
398 QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
never executed (the execution status of this line is deduced): QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
-
399 if (!withinClipRect.isEmpty())
never evaluated: !withinClipRect.isEmpty()
0
400 surfaceRect &= withinClipRect;
never executed: surfaceRect &= withinClipRect;
0
401 return QRegion(surfaceRect);
never executed: return QRegion(surfaceRect);
0
402 } -
403 -
404 QRegion region;
executed (the execution status of this line is deduced): QRegion region;
-
405 if (parent && parent->d_func()->children.isEmpty())
partially evaluated: parent
TRUEFALSE
yes
Evaluation Count:3338
no
Evaluation Count:0
evaluated: parent->d_func()->children.isEmpty()
TRUEFALSE
yes
Evaluation Count:2017
yes
Evaluation Count:1321
0-3338
406 return region;
executed: return region;
Execution Count:2017
2017
407 -
408 const bool clipToRect = !withinClipRect.isEmpty();
executed (the execution status of this line is deduced): const bool clipToRect = !withinClipRect.isEmpty();
-
409 const int count = staticWidgets.count();
executed (the execution status of this line is deduced): const int count = staticWidgets.count();
-
410 for (int i = 0; i < count; ++i) {
partially evaluated: i < count
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1321
0-1321
411 QWidget *w = staticWidgets.at(i);
never executed (the execution status of this line is deduced): QWidget *w = staticWidgets.at(i);
-
412 QWidgetPrivate *wd = w->d_func();
never executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
413 if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty()
never evaluated: !wd->isOpaque
never evaluated: !wd->extra
never evaluated: wd->extra->staticContentsSize.isEmpty()
0
414 || !w->isVisible() || (parent && !parent->isAncestorOf(w))) {
never evaluated: !w->isVisible()
never evaluated: parent
never evaluated: !parent->isAncestorOf(w)
0
415 continue;
never executed: continue;
0
416 } -
417 -
418 QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height());
never executed (the execution status of this line is deduced): QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height());
-
419 const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint());
never executed (the execution status of this line is deduced): const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint());
-
420 if (clipToRect)
never evaluated: clipToRect
0
421 rect &= withinClipRect.translated(-offset);
never executed: rect &= withinClipRect.translated(-offset);
0
422 if (rect.isEmpty())
never evaluated: rect.isEmpty()
0
423 continue;
never executed: continue;
0
424 -
425 rect &= wd->clipRect();
never executed (the execution status of this line is deduced): rect &= wd->clipRect();
-
426 if (rect.isEmpty())
never evaluated: rect.isEmpty()
0
427 continue;
never executed: continue;
0
428 -
429 QRegion visible(rect);
never executed (the execution status of this line is deduced): QRegion visible(rect);
-
430 wd->clipToEffectiveMask(visible);
never executed (the execution status of this line is deduced): wd->clipToEffectiveMask(visible);
-
431 if (visible.isEmpty())
never evaluated: visible.isEmpty()
0
432 continue;
never executed: continue;
0
433 wd->subtractOpaqueSiblings(visible, 0, /*alsoNonOpaque=*/true);
never executed (the execution status of this line is deduced): wd->subtractOpaqueSiblings(visible, 0, true);
-
434 -
435 visible.translate(offset);
never executed (the execution status of this line is deduced): visible.translate(offset);
-
436 region += visible;
never executed (the execution status of this line is deduced): region += visible;
-
437 }
never executed: }
0
438 -
439 return region;
executed: return region;
Execution Count:1321
1321
440} -
441 -
442static inline void sendUpdateRequest(QWidget *widget, bool updateImmediately) -
443{ -
444 if (!widget)
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:11567
0-11567
445 return;
never executed: return;
0
446 -
447 if (updateImmediately) {
evaluated: updateImmediately
TRUEFALSE
yes
Evaluation Count:266
yes
Evaluation Count:11301
266-11301
448 QEvent event(QEvent::UpdateRequest);
executed (the execution status of this line is deduced): QEvent event(QEvent::UpdateRequest);
-
449 QApplication::sendEvent(widget, &event);
executed (the execution status of this line is deduced): QApplication::sendEvent(widget, &event);
-
450 } else {
executed: }
Execution Count:266
266
451 QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
executed (the execution status of this line is deduced): QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority);
-
452 }
executed: }
Execution Count:11301
11301
453} -
454 -
455/*! -
456 Marks the region of the widget as dirty (if not already marked as dirty) and -
457 posts an UpdateRequest event to the top-level widget (if not already posted). -
458 -
459 If updateImmediately is true, the event is sent immediately instead of posted. -
460 -
461 If invalidateBuffer is true, all widgets intersecting with the region will be dirty. -
462 -
463 If the widget paints directly on screen, the event is sent to the widget -
464 instead of the top-level widget, and invalidateBuffer is completely ignored. -
465 -
466 ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -
467*/ -
468void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool updateImmediately, -
469 bool invalidateBuffer) -
470{ -
471 Q_ASSERT(tlw->d_func()->extra);
executed (the execution status of this line is deduced): qt_noop();
-
472 Q_ASSERT(tlw->d_func()->extra->topextra);
executed (the execution status of this line is deduced): qt_noop();
-
473 Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize);
executed (the execution status of this line is deduced): qt_noop();
-
474 Q_ASSERT(widget->isVisible() && widget->updatesEnabled());
executed (the execution status of this line is deduced): qt_noop();
-
475 Q_ASSERT(widget->window() == tlw);
executed (the execution status of this line is deduced): qt_noop();
-
476 Q_ASSERT(!rgn.isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
477 -
478#ifndef QT_NO_GRAPHICSEFFECT -
479 widget->d_func()->invalidateGraphicsEffectsRecursively();
executed (the execution status of this line is deduced): widget->d_func()->invalidateGraphicsEffectsRecursively();
-
480#endif //QT_NO_GRAPHICSEFFECT -
481 -
482 if (widget->d_func()->paintOnScreen()) {
evaluated: widget->d_func()->paintOnScreen()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:30373
6-30373
483 if (widget->d_func()->dirty.isEmpty()) {
evaluated: widget->d_func()->dirty.isEmpty()
TRUEFALSE
yes
Evaluation Count:3
yes
Evaluation Count:3
3
484 widget->d_func()->dirty = rgn;
executed (the execution status of this line is deduced): widget->d_func()->dirty = rgn;
-
485 sendUpdateRequest(widget, updateImmediately);
executed (the execution status of this line is deduced): sendUpdateRequest(widget, updateImmediately);
-
486 return;
executed: return;
Execution Count:3
3
487 } else if (qt_region_strictContains(widget->d_func()->dirty, widget->rect())) {
partially evaluated: qt_region_strictContains(widget->d_func()->dirty, widget->rect())
TRUEFALSE
yes
Evaluation Count:3
no
Evaluation Count:0
0-3
488 if (updateImmediately)
partially evaluated: updateImmediately
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3
0-3
489 sendUpdateRequest(widget, updateImmediately);
never executed: sendUpdateRequest(widget, updateImmediately);
0
490 return; // Already dirty.
executed: return;
Execution Count:3
3
491 } -
492 -
493 const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty();
never executed (the execution status of this line is deduced): const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty();
-
494 widget->d_func()->dirty += rgn;
never executed (the execution status of this line is deduced): widget->d_func()->dirty += rgn;
-
495 if (!eventAlreadyPosted || updateImmediately)
never evaluated: !eventAlreadyPosted
never evaluated: updateImmediately
0
496 sendUpdateRequest(widget, updateImmediately);
never executed: sendUpdateRequest(widget, updateImmediately);
0
497 return;
never executed: return;
0
498 } -
499 -
500 if (fullUpdatePending) {
partially evaluated: fullUpdatePending
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:30373
0-30373
501 if (updateImmediately)
never evaluated: updateImmediately
0
502 sendUpdateRequest(tlw, updateImmediately);
never executed: sendUpdateRequest(tlw, updateImmediately);
0
503 return;
never executed: return;
0
504 } -
505 -
506 const QPoint offset = widget->mapTo(tlw, QPoint());
executed (the execution status of this line is deduced): const QPoint offset = widget->mapTo(tlw, QPoint());
-
507 const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect());
executed (the execution status of this line is deduced): const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect());
-
508 if (qt_region_strictContains(dirty, widgetRect.translated(offset))) {
evaluated: qt_region_strictContains(dirty, widgetRect.translated(offset))
TRUEFALSE
yes
Evaluation Count:23275
yes
Evaluation Count:7098
7098-23275
509 if (updateImmediately)
partially evaluated: updateImmediately
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:23275
0-23275
510 sendUpdateRequest(tlw, updateImmediately);
never executed: sendUpdateRequest(tlw, updateImmediately);
0
511 return; // Already dirty.
executed: return;
Execution Count:23275
23275
512 } -
513 -
514 if (invalidateBuffer) {
evaluated: invalidateBuffer
TRUEFALSE
yes
Evaluation Count:691
yes
Evaluation Count:6407
691-6407
515 const bool eventAlreadyPosted = !dirty.isEmpty();
executed (the execution status of this line is deduced): const bool eventAlreadyPosted = !dirty.isEmpty();
-
516#ifndef QT_NO_GRAPHICSEFFECT -
517 if (widget->d_func()->graphicsEffect)
partially evaluated: widget->d_func()->graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:691
0-691
518 dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset);
never executed: dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset);
0
519 else -
520#endif //QT_NO_GRAPHICSEFFECT -
521 dirty += rgn.translated(offset);
executed: dirty += rgn.translated(offset);
Execution Count:691
691
522 if (!eventAlreadyPosted || updateImmediately)
evaluated: !eventAlreadyPosted
TRUEFALSE
yes
Evaluation Count:149
yes
Evaluation Count:542
partially evaluated: updateImmediately
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:542
0-542
523 sendUpdateRequest(tlw, updateImmediately);
executed: sendUpdateRequest(tlw, updateImmediately);
Execution Count:149
149
524 return;
executed: return;
Execution Count:691
691
525 } -
526 -
527 if (dirtyWidgets.isEmpty()) {
evaluated: dirtyWidgets.isEmpty()
TRUEFALSE
yes
Evaluation Count:1072
yes
Evaluation Count:5335
1072-5335
528 addDirtyWidget(widget, rgn);
executed (the execution status of this line is deduced): addDirtyWidget(widget, rgn);
-
529 sendUpdateRequest(tlw, updateImmediately);
executed (the execution status of this line is deduced): sendUpdateRequest(tlw, updateImmediately);
-
530 return;
executed: return;
Execution Count:1072
1072
531 } -
532 -
533 if (widget->d_func()->inDirtyList) {
evaluated: widget->d_func()->inDirtyList
TRUEFALSE
yes
Evaluation Count:3550
yes
Evaluation Count:1785
1785-3550
534 if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) {
evaluated: !qt_region_strictContains(widget->d_func()->dirty, widgetRect)
TRUEFALSE
yes
Evaluation Count:2609
yes
Evaluation Count:941
941-2609
535#ifndef QT_NO_GRAPHICSEFFECT -
536 if (widget->d_func()->graphicsEffect)
partially evaluated: widget->d_func()->graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2609
0-2609
537 widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect());
never executed: widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect());
0
538 else -
539#endif //QT_NO_GRAPHICSEFFECT -
540 widget->d_func()->dirty += rgn;
executed: widget->d_func()->dirty += rgn;
Execution Count:2609
2609
541 } -
542 } else {
executed: }
Execution Count:3550
3550
543 addDirtyWidget(widget, rgn);
executed (the execution status of this line is deduced): addDirtyWidget(widget, rgn);
-
544 }
executed: }
Execution Count:1785
1785
545 -
546 if (updateImmediately)
partially evaluated: updateImmediately
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:5335
0-5335
547 sendUpdateRequest(tlw, updateImmediately);
never executed: sendUpdateRequest(tlw, updateImmediately);
0
548}
executed: }
Execution Count:5335
5335
549 -
550/*! -
551 This function is equivalent to calling markDirty(QRegion(rect), ...), but -
552 is more efficient as it eliminates QRegion operations/allocations and can -
553 use the rect more precisely for additional cut-offs. -
554 -
555 ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -
556*/ -
557void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool updateImmediately, -
558 bool invalidateBuffer) -
559{ -
560 Q_ASSERT(tlw->d_func()->extra);
executed (the execution status of this line is deduced): qt_noop();
-
561 Q_ASSERT(tlw->d_func()->extra->topextra);
executed (the execution status of this line is deduced): qt_noop();
-
562 Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize);
executed (the execution status of this line is deduced): qt_noop();
-
563 Q_ASSERT(widget->isVisible() && widget->updatesEnabled());
executed (the execution status of this line is deduced): qt_noop();
-
564 Q_ASSERT(widget->window() == tlw);
executed (the execution status of this line is deduced): qt_noop();
-
565 Q_ASSERT(!rect.isEmpty());
executed (the execution status of this line is deduced): qt_noop();
-
566 -
567#ifndef QT_NO_GRAPHICSEFFECT -
568 widget->d_func()->invalidateGraphicsEffectsRecursively();
executed (the execution status of this line is deduced): widget->d_func()->invalidateGraphicsEffectsRecursively();
-
569#endif //QT_NO_GRAPHICSEFFECT -
570 -
571 if (widget->d_func()->paintOnScreen()) {
evaluated: widget->d_func()->paintOnScreen()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:99330
6-99330
572 if (widget->d_func()->dirty.isEmpty()) {
partially evaluated: widget->d_func()->dirty.isEmpty()
TRUEFALSE
yes
Evaluation Count:6
no
Evaluation Count:0
0-6
573 widget->d_func()->dirty = QRegion(rect);
executed (the execution status of this line is deduced): widget->d_func()->dirty = QRegion(rect);
-
574 sendUpdateRequest(widget, updateImmediately);
executed (the execution status of this line is deduced): sendUpdateRequest(widget, updateImmediately);
-
575 return;
executed: return;
Execution Count:6
6
576 } else if (qt_region_strictContains(widget->d_func()->dirty, rect)) {
never evaluated: qt_region_strictContains(widget->d_func()->dirty, rect)
0
577 if (updateImmediately)
never evaluated: updateImmediately
0
578 sendUpdateRequest(widget, updateImmediately);
never executed: sendUpdateRequest(widget, updateImmediately);
0
579 return; // Already dirty.
never executed: return;
0
580 } -
581 -
582 const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty();
never executed (the execution status of this line is deduced): const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty();
-
583 widget->d_func()->dirty += rect;
never executed (the execution status of this line is deduced): widget->d_func()->dirty += rect;
-
584 if (!eventAlreadyPosted || updateImmediately)
never evaluated: !eventAlreadyPosted
never evaluated: updateImmediately
0
585 sendUpdateRequest(widget, updateImmediately);
never executed: sendUpdateRequest(widget, updateImmediately);
0
586 return;
never executed: return;
0
587 } -
588 -
589 if (fullUpdatePending) {
partially evaluated: fullUpdatePending
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:99330
0-99330
590 if (updateImmediately)
never evaluated: updateImmediately
0
591 sendUpdateRequest(tlw, updateImmediately);
never executed: sendUpdateRequest(tlw, updateImmediately);
0
592 return;
never executed: return;
0
593 } -
594 -
595 const QRect widgetRect = widget->d_func()->effectiveRectFor(rect);
executed (the execution status of this line is deduced): const QRect widgetRect = widget->d_func()->effectiveRectFor(rect);
-
596 const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint())));
executed (the execution status of this line is deduced): const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint())));
-
597 if (qt_region_strictContains(dirty, translatedRect)) {
evaluated: qt_region_strictContains(dirty, translatedRect)
TRUEFALSE
yes
Evaluation Count:61658
yes
Evaluation Count:37672
37672-61658
598 if (updateImmediately)
evaluated: updateImmediately
TRUEFALSE
yes
Evaluation Count:43
yes
Evaluation Count:61615
43-61615
599 sendUpdateRequest(tlw, updateImmediately);
executed: sendUpdateRequest(tlw, updateImmediately);
Execution Count:43
43
600 return; // Already dirty
executed: return;
Execution Count:61658
61658
601 } -
602 -
603 if (invalidateBuffer) {
evaluated: invalidateBuffer
TRUEFALSE
yes
Evaluation Count:6211
yes
Evaluation Count:31461
6211-31461
604 const bool eventAlreadyPosted = !dirty.isEmpty();
executed (the execution status of this line is deduced): const bool eventAlreadyPosted = !dirty.isEmpty();
-
605 dirty += translatedRect;
executed (the execution status of this line is deduced): dirty += translatedRect;
-
606 if (!eventAlreadyPosted || updateImmediately)
evaluated: !eventAlreadyPosted
TRUEFALSE
yes
Evaluation Count:4383
yes
Evaluation Count:1828
partially evaluated: updateImmediately
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1828
0-4383
607 sendUpdateRequest(tlw, updateImmediately);
executed: sendUpdateRequest(tlw, updateImmediately);
Execution Count:4383
4383
608 return;
executed: return;
Execution Count:6211
6211
609 } -
610 -
611 if (dirtyWidgets.isEmpty()) {
evaluated: dirtyWidgets.isEmpty()
TRUEFALSE
yes
Evaluation Count:5724
yes
Evaluation Count:25737
5724-25737
612 addDirtyWidget(widget, rect);
executed (the execution status of this line is deduced): addDirtyWidget(widget, rect);
-
613 sendUpdateRequest(tlw, updateImmediately);
executed (the execution status of this line is deduced): sendUpdateRequest(tlw, updateImmediately);
-
614 return;
executed: return;
Execution Count:5724
5724
615 } -
616 -
617 if (widget->d_func()->inDirtyList) {
evaluated: widget->d_func()->inDirtyList
TRUEFALSE
yes
Evaluation Count:21356
yes
Evaluation Count:4381
4381-21356
618 if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect))
evaluated: !qt_region_strictContains(widget->d_func()->dirty, widgetRect)
TRUEFALSE
yes
Evaluation Count:8082
yes
Evaluation Count:13274
8082-13274
619 widget->d_func()->dirty += widgetRect;
executed: widget->d_func()->dirty += widgetRect;
Execution Count:8082
8082
620 } else {
executed: }
Execution Count:21356
21356
621 addDirtyWidget(widget, rect);
executed (the execution status of this line is deduced): addDirtyWidget(widget, rect);
-
622 }
executed: }
Execution Count:4381
4381
623 -
624 if (updateImmediately)
evaluated: updateImmediately
TRUEFALSE
yes
Evaluation Count:187
yes
Evaluation Count:25550
187-25550
625 sendUpdateRequest(tlw, updateImmediately);
executed: sendUpdateRequest(tlw, updateImmediately);
Execution Count:187
187
626}
executed: }
Execution Count:25737
25737
627 -
628/*! -
629 Marks the \a region of the \a widget as dirty on screen. The \a region will be copied from -
630 the backing store to the \a widget's native parent next time flush() is called. -
631 -
632 Paint on screen widgets are ignored. -
633*/ -
634void QWidgetBackingStore::markDirtyOnScreen(const QRegion &region, QWidget *widget, const QPoint &topLevelOffset) -
635{ -
636 if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty())
partially evaluated: !widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16253
partially evaluated: widget->d_func()->paintOnScreen()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:16253
evaluated: region.isEmpty()
TRUEFALSE
yes
Evaluation Count:1577
yes
Evaluation Count:14676
0-16253
637 return;
executed: return;
Execution Count:1577
1577
638 -
639#if defined(Q_WS_MAC) -
640 if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) -
641 dirtyOnScreen += region.translated(topLevelOffset); -
642 return; -
643#endif -
644 -
645 // Top-level. -
646 if (widget == tlw) {
evaluated: widget == tlw
TRUEFALSE
yes
Evaluation Count:1513
yes
Evaluation Count:13163
1513-13163
647 if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))
partially evaluated: !widget->testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
yes
Evaluation Count:1513
no
Evaluation Count:0
0-1513
648 dirtyOnScreen += region;
executed: dirtyOnScreen += region;
Execution Count:1513
1513
649 return;
executed: return;
Execution Count:1513
1513
650 } -
651 -
652 // Alien widgets. -
653 if (!widget->internalWinId() && !widget->isWindow()) {
evaluated: !widget->internalWinId()
TRUEFALSE
yes
Evaluation Count:13130
yes
Evaluation Count:33
partially evaluated: !widget->isWindow()
TRUEFALSE
yes
Evaluation Count:13130
no
Evaluation Count:0
0-13130
654 QWidget *nativeParent = widget->nativeParentWidget(); // Alien widgets with the top-level as the native parent (common case).
executed (the execution status of this line is deduced): QWidget *nativeParent = widget->nativeParentWidget();
-
655 if (nativeParent == tlw) {
evaluated: nativeParent == tlw
TRUEFALSE
yes
Evaluation Count:13128
yes
Evaluation Count:2
2-13128
656 if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))
evaluated: !widget->testAttribute(Qt::WA_WState_InPaintEvent)
TRUEFALSE
yes
Evaluation Count:13127
yes
Evaluation Count:1
1-13127
657 dirtyOnScreen += region.translated(topLevelOffset);
executed: dirtyOnScreen += region.translated(topLevelOffset);
Execution Count:13127
13127
658 return;
executed: return;
Execution Count:13128
13128
659 } -
660 -
661 // Alien widgets with native parent != tlw. -
662 QWidgetPrivate *nativeParentPrivate = nativeParent->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *nativeParentPrivate = nativeParent->d_func();
-
663 if (!nativeParentPrivate->needsFlush)
partially evaluated: !nativeParentPrivate->needsFlush
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2
0-2
664 nativeParentPrivate->needsFlush = new QRegion;
never executed: nativeParentPrivate->needsFlush = new QRegion;
0
665 const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
executed (the execution status of this line is deduced): const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
-
666 *nativeParentPrivate->needsFlush += region.translated(nativeParentOffset);
executed (the execution status of this line is deduced): *nativeParentPrivate->needsFlush += region.translated(nativeParentOffset);
-
667 appendDirtyOnScreenWidget(nativeParent);
executed (the execution status of this line is deduced): appendDirtyOnScreenWidget(nativeParent);
-
668 return;
executed: return;
Execution Count:2
2
669 } -
670 -
671 // Native child widgets. -
672 QWidgetPrivate *widgetPrivate = widget->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *widgetPrivate = widget->d_func();
-
673 if (!widgetPrivate->needsFlush)
evaluated: !widgetPrivate->needsFlush
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:23
10-23
674 widgetPrivate->needsFlush = new QRegion;
executed: widgetPrivate->needsFlush = new QRegion;
Execution Count:10
10
675 *widgetPrivate->needsFlush += region;
executed (the execution status of this line is deduced): *widgetPrivate->needsFlush += region;
-
676 appendDirtyOnScreenWidget(widget);
executed (the execution status of this line is deduced): appendDirtyOnScreenWidget(widget);
-
677}
executed: }
Execution Count:33
33
678 -
679void QWidgetBackingStore::removeDirtyWidget(QWidget *w) -
680{ -
681 if (!w)
partially evaluated: !w
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:80499
0-80499
682 return;
never executed: return;
0
683 -
684 dirtyWidgetsRemoveAll(w);
executed (the execution status of this line is deduced): dirtyWidgetsRemoveAll(w);
-
685 dirtyOnScreenWidgetsRemoveAll(w);
executed (the execution status of this line is deduced): dirtyOnScreenWidgetsRemoveAll(w);
-
686 resetWidget(w);
executed (the execution status of this line is deduced): resetWidget(w);
-
687 -
688 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
689 const int n = wd->children.count();
executed (the execution status of this line is deduced): const int n = wd->children.count();
-
690 for (int i = 0; i < n; ++i) {
evaluated: i < n
TRUEFALSE
yes
Evaluation Count:95534
yes
Evaluation Count:80499
80499-95534
691 if (QWidget *child = qobject_cast<QWidget*>(wd->children.at(i)))
evaluated: QWidget *child = qobject_cast<QWidget*>(wd->children.at(i))
TRUEFALSE
yes
Evaluation Count:56637
yes
Evaluation Count:38897
38897-56637
692 removeDirtyWidget(child);
executed: removeDirtyWidget(child);
Execution Count:56637
56637
693 }
executed: }
Execution Count:95534
95534
694}
executed: }
Execution Count:80499
80499
695 -
696void QWidgetBackingStore::updateLists(QWidget *cur) -
697{ -
698 if (!cur)
partially evaluated: !cur
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:19428
0-19428
699 return;
never executed: return;
0
700 -
701 QList<QObject*> children = cur->children();
executed (the execution status of this line is deduced): QList<QObject*> children = cur->children();
-
702 for (int i = 0; i < children.size(); ++i) {
evaluated: i < children.size()
TRUEFALSE
yes
Evaluation Count:27487
yes
Evaluation Count:19428
19428-27487
703 QWidget *child = qobject_cast<QWidget*>(children.at(i));
executed (the execution status of this line is deduced): QWidget *child = qobject_cast<QWidget*>(children.at(i));
-
704 if (!child)
evaluated: !child
TRUEFALSE
yes
Evaluation Count:10563
yes
Evaluation Count:16924
10563-16924
705 continue;
executed: continue;
Execution Count:10563
10563
706 -
707 updateLists(child);
executed (the execution status of this line is deduced): updateLists(child);
-
708 }
executed: }
Execution Count:16924
16924
709 -
710 if (cur->testAttribute(Qt::WA_StaticContents))
evaluated: cur->testAttribute(Qt::WA_StaticContents)
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:19422
6-19422
711 addStaticWidget(cur);
executed: addStaticWidget(cur);
Execution Count:6
6
712}
executed: }
Execution Count:19428
19428
713 -
714QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) -
715 : tlw(topLevel), dirtyOnScreenWidgets(0), fullUpdatePending(0) -
716{ -
717 store = tlw->backingStore();
executed (the execution status of this line is deduced): store = tlw->backingStore();
-
718 Q_ASSERT(store);
executed (the execution status of this line is deduced): qt_noop();
-
719 -
720 // Ensure all existing subsurfaces and static widgets are added to their respective lists. -
721 updateLists(topLevel);
executed (the execution status of this line is deduced): updateLists(topLevel);
-
722}
executed: }
Execution Count:2504
2504
723 -
724QWidgetBackingStore::~QWidgetBackingStore() -
725{ -
726 for (int c = 0; c < dirtyWidgets.size(); ++c) {
evaluated: c < dirtyWidgets.size()
TRUEFALSE
yes
Evaluation Count:7
yes
Evaluation Count:2503
7-2503
727 resetWidget(dirtyWidgets.at(c));
executed (the execution status of this line is deduced): resetWidget(dirtyWidgets.at(c));
-
728 }
executed: }
Execution Count:7
7
729 -
730 delete dirtyOnScreenWidgets;
executed (the execution status of this line is deduced): delete dirtyOnScreenWidgets;
-
731 dirtyOnScreenWidgets = 0;
executed (the execution status of this line is deduced): dirtyOnScreenWidgets = 0;
-
732}
executed: }
Execution Count:2503
2503
733 -
734//parent's coordinates; move whole rect; update parent and widget -
735//assume the screen blt has already been done, so we don't need to refresh that part -
736void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) -
737{ -
738 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
739 if (!q->isVisible() || (dx == 0 && dy == 0))
partially evaluated: !q->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:388
evaluated: dx == 0
TRUEFALSE
yes
Evaluation Count:215
yes
Evaluation Count:173
partially evaluated: dy == 0
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:215
0-388
740 return;
never executed: return;
0
741 -
742 QWidget *tlw = q->window();
executed (the execution status of this line is deduced): QWidget *tlw = q->window();
-
743 QTLWExtra* x = tlw->d_func()->topData();
executed (the execution status of this line is deduced): QTLWExtra* x = tlw->d_func()->topData();
-
744 if (x->inTopLevelResize)
partially evaluated: x->inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:388
0-388
745 return;
never executed: return;
0
746 -
747 static int accelEnv = -1; -
748 if (accelEnv == -1) {
evaluated: accelEnv == -1
TRUEFALSE
yes
Evaluation Count:27
yes
Evaluation Count:361
27-361
749 accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0;
executed (the execution status of this line is deduced): accelEnv = qgetenv("QT_NO_FAST_MOVE").toInt() == 0;
-
750 }
executed: }
Execution Count:27
27
751 -
752 QWidget *pw = q->parentWidget();
executed (the execution status of this line is deduced): QWidget *pw = q->parentWidget();
-
753 QPoint toplevelOffset = pw->mapTo(tlw, QPoint());
executed (the execution status of this line is deduced): QPoint toplevelOffset = pw->mapTo(tlw, QPoint());
-
754 QWidgetPrivate *pd = pw->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *pd = pw->d_func();
-
755 QRect clipR(pd->clipRect());
executed (the execution status of this line is deduced): QRect clipR(pd->clipRect());
-
756 const QRect newRect(rect.translated(dx, dy));
executed (the execution status of this line is deduced): const QRect newRect(rect.translated(dx, dy));
-
757 QRect destRect = rect.intersected(clipR);
executed (the execution status of this line is deduced): QRect destRect = rect.intersected(clipR);
-
758 if (destRect.isValid())
evaluated: destRect.isValid()
TRUEFALSE
yes
Evaluation Count:350
yes
Evaluation Count:38
38-350
759 destRect = destRect.translated(dx, dy).intersected(clipR);
executed: destRect = destRect.translated(dx, dy).intersected(clipR);
Execution Count:350
350
760 const QRect sourceRect(destRect.translated(-dx, -dy));
executed (the execution status of this line is deduced): const QRect sourceRect(destRect.translated(-dx, -dy));
-
761 const QRect parentRect(rect & clipR);
executed (the execution status of this line is deduced): const QRect parentRect(rect & clipR);
-
762 -
763 bool accelerateMove = accelEnv && isOpaque
partially evaluated: accelEnv
TRUEFALSE
yes
Evaluation Count:388
no
Evaluation Count:0
evaluated: isOpaque
TRUEFALSE
yes
Evaluation Count:75
yes
Evaluation Count:313
0-388
764#ifndef QT_NO_GRAPHICSVIEW
executed (the execution status of this line is deduced):
-
765 // No accelerate move for proxy widgets.
executed (the execution status of this line is deduced):
-
766 && !tlw->d_func()->extra->proxyWidget
partially evaluated: !tlw->d_func()->extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:75
no
Evaluation Count:0
0-75
767#endif
executed (the execution status of this line is deduced):
-
768 && !isOverlapped(sourceRect) && !isOverlapped(destRect);
evaluated: !isOverlapped(sourceRect)
TRUEFALSE
yes
Evaluation Count:70
yes
Evaluation Count:5
partially evaluated: !isOverlapped(destRect)
TRUEFALSE
yes
Evaluation Count:70
no
Evaluation Count:0
0-70
769 -
770 if (!accelerateMove) {
evaluated: !accelerateMove
TRUEFALSE
yes
Evaluation Count:318
yes
Evaluation Count:70
70-318
771 QRegion parentR(effectiveRectFor(parentRect));
executed (the execution status of this line is deduced): QRegion parentR(effectiveRectFor(parentRect));
-
772 if (!extra || !extra->hasMask) {
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:84
yes
Evaluation Count:234
evaluated: !extra->hasMask
TRUEFALSE
yes
Evaluation Count:214
yes
Evaluation Count:20
20-234
773 parentR -= newRect;
executed (the execution status of this line is deduced): parentR -= newRect;
-
774 } else {
executed: }
Execution Count:298
298
775 // invalidateBuffer() excludes anything outside the mask -
776 parentR += newRect & clipR;
executed (the execution status of this line is deduced): parentR += newRect & clipR;
-
777 }
executed: }
Execution Count:20
20
778 pd->invalidateBuffer(parentR);
executed (the execution status of this line is deduced): pd->invalidateBuffer(parentR);
-
779 invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft()));
executed (the execution status of this line is deduced): invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft()));
-
780 } else {
executed: }
Execution Count:318
318
781 -
782 QWidgetBackingStore *wbs = x->backingStoreTracker.data();
executed (the execution status of this line is deduced): QWidgetBackingStore *wbs = x->backingStoreTracker.data();
-
783 QRegion childExpose(newRect & clipR);
executed (the execution status of this line is deduced): QRegion childExpose(newRect & clipR);
-
784 -
785 if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw))
evaluated: sourceRect.isValid()
TRUEFALSE
yes
Evaluation Count:65
yes
Evaluation Count:5
evaluated: wbs->bltRect(sourceRect, dx, dy, pw)
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:50
5-65
786 childExpose -= destRect;
executed: childExpose -= destRect;
Execution Count:15
15
787 -
788 if (!pw->updatesEnabled())
evaluated: !pw->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:69
1-69
789 return;
executed: return;
Execution Count:1
1
790 -
791 const bool childUpdatesEnabled = q->updatesEnabled();
executed (the execution status of this line is deduced): const bool childUpdatesEnabled = q->updatesEnabled();
-
792 if (childUpdatesEnabled && !childExpose.isEmpty()) {
partially evaluated: childUpdatesEnabled
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
evaluated: !childExpose.isEmpty()
TRUEFALSE
yes
Evaluation Count:55
yes
Evaluation Count:14
0-69
793 childExpose.translate(-data.crect.topLeft());
executed (the execution status of this line is deduced): childExpose.translate(-data.crect.topLeft());
-
794 wbs->markDirty(childExpose, q);
executed (the execution status of this line is deduced): wbs->markDirty(childExpose, q);
-
795 isMoved = true;
executed (the execution status of this line is deduced): isMoved = true;
-
796 }
executed: }
Execution Count:55
55
797 -
798 QRegion parentExpose(parentRect);
executed (the execution status of this line is deduced): QRegion parentExpose(parentRect);
-
799 parentExpose -= newRect;
executed (the execution status of this line is deduced): parentExpose -= newRect;
-
800 if (extra && extra->hasMask)
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
partially evaluated: extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:69
0-69
801 parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft());
never executed: parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft());
0
802 -
803 if (!parentExpose.isEmpty()) {
evaluated: !parentExpose.isEmpty()
TRUEFALSE
yes
Evaluation Count:56
yes
Evaluation Count:13
13-56
804 wbs->markDirty(parentExpose, pw);
executed (the execution status of this line is deduced): wbs->markDirty(parentExpose, pw);
-
805 pd->isMoved = true;
executed (the execution status of this line is deduced): pd->isMoved = true;
-
806 }
executed: }
Execution Count:56
56
807 -
808 if (childUpdatesEnabled) {
partially evaluated: childUpdatesEnabled
TRUEFALSE
yes
Evaluation Count:69
no
Evaluation Count:0
0-69
809 QRegion needsFlush(sourceRect);
executed (the execution status of this line is deduced): QRegion needsFlush(sourceRect);
-
810 needsFlush += destRect;
executed (the execution status of this line is deduced): needsFlush += destRect;
-
811 wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset);
executed (the execution status of this line is deduced): wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset);
-
812 }
executed: }
Execution Count:69
69
813 }
executed: }
Execution Count:69
69
814} -
815 -
816//widget's coordinates; scroll within rect; only update widget -
817void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) -
818{ -
819 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
820 QWidget *tlw = q->window();
executed (the execution status of this line is deduced): QWidget *tlw = q->window();
-
821 QTLWExtra* x = tlw->d_func()->topData();
executed (the execution status of this line is deduced): QTLWExtra* x = tlw->d_func()->topData();
-
822 if (x->inTopLevelResize)
partially evaluated: x->inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14649
0-14649
823 return;
never executed: return;
0
824 -
825 QWidgetBackingStore *wbs = x->backingStoreTracker.data();
executed (the execution status of this line is deduced): QWidgetBackingStore *wbs = x->backingStoreTracker.data();
-
826 if (!wbs)
partially evaluated: !wbs
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14649
0-14649
827 return;
never executed: return;
0
828 -
829 static int accelEnv = -1; -
830 if (accelEnv == -1) {
evaluated: accelEnv == -1
TRUEFALSE
yes
Evaluation Count:16
yes
Evaluation Count:14633
16-14633
831 accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
executed (the execution status of this line is deduced): accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
-
832 }
executed: }
Execution Count:16
16
833 -
834 QRect scrollRect = rect & clipRect();
executed (the execution status of this line is deduced): QRect scrollRect = rect & clipRect();
-
835 bool overlapped = false;
executed (the execution status of this line is deduced): bool overlapped = false;
-
836 bool accelerateScroll = accelEnv && isOpaque
partially evaluated: accelEnv
TRUEFALSE
yes
Evaluation Count:14649
no
Evaluation Count:0
partially evaluated: isOpaque
TRUEFALSE
yes
Evaluation Count:14649
no
Evaluation Count:0
0-14649
837 && !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft())));
partially evaluated: !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft())))
TRUEFALSE
yes
Evaluation Count:14649
no
Evaluation Count:0
0-14649
838 -
839 if (!accelerateScroll) {
partially evaluated: !accelerateScroll
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14649
0-14649
840 if (overlapped) {
never evaluated: overlapped
0
841 QRegion region(scrollRect);
never executed (the execution status of this line is deduced): QRegion region(scrollRect);
-
842 subtractOpaqueSiblings(region);
never executed (the execution status of this line is deduced): subtractOpaqueSiblings(region);
-
843 invalidateBuffer(region);
never executed (the execution status of this line is deduced): invalidateBuffer(region);
-
844 }else {
never executed: }
0
845 invalidateBuffer(scrollRect);
never executed (the execution status of this line is deduced): invalidateBuffer(scrollRect);
-
846 }
never executed: }
0
847 } else { -
848 const QPoint toplevelOffset = q->mapTo(tlw, QPoint());
executed (the execution status of this line is deduced): const QPoint toplevelOffset = q->mapTo(tlw, QPoint());
-
849 const QRect destRect = scrollRect.translated(dx, dy) & scrollRect;
executed (the execution status of this line is deduced): const QRect destRect = scrollRect.translated(dx, dy) & scrollRect;
-
850 const QRect sourceRect = destRect.translated(-dx, -dy);
executed (the execution status of this line is deduced): const QRect sourceRect = destRect.translated(-dx, -dy);
-
851 -
852 QRegion childExpose(scrollRect);
executed (the execution status of this line is deduced): QRegion childExpose(scrollRect);
-
853 if (sourceRect.isValid()) {
evaluated: sourceRect.isValid()
TRUEFALSE
yes
Evaluation Count:13077
yes
Evaluation Count:1572
1572-13077
854 if (wbs->bltRect(sourceRect, dx, dy, q))
evaluated: wbs->bltRect(sourceRect, dx, dy, q)
TRUEFALSE
yes
Evaluation Count:1876
yes
Evaluation Count:11201
1876-11201
855 childExpose -= destRect;
executed: childExpose -= destRect;
Execution Count:1876
1876
856 }
executed: }
Execution Count:13077
13077
857 -
858 if (inDirtyList) {
evaluated: inDirtyList
TRUEFALSE
yes
Evaluation Count:8959
yes
Evaluation Count:5690
5690-8959
859 if (rect == q->rect()) {
partially evaluated: rect == q->rect()
TRUEFALSE
yes
Evaluation Count:8959
no
Evaluation Count:0
0-8959
860 dirty.translate(dx, dy);
executed (the execution status of this line is deduced): dirty.translate(dx, dy);
-
861 } else {
executed: }
Execution Count:8959
8959
862 QRegion dirtyScrollRegion = dirty.intersected(scrollRect);
never executed (the execution status of this line is deduced): QRegion dirtyScrollRegion = dirty.intersected(scrollRect);
-
863 if (!dirtyScrollRegion.isEmpty()) {
never evaluated: !dirtyScrollRegion.isEmpty()
0
864 dirty -= dirtyScrollRegion;
never executed (the execution status of this line is deduced): dirty -= dirtyScrollRegion;
-
865 dirtyScrollRegion.translate(dx, dy);
never executed (the execution status of this line is deduced): dirtyScrollRegion.translate(dx, dy);
-
866 dirty += dirtyScrollRegion;
never executed (the execution status of this line is deduced): dirty += dirtyScrollRegion;
-
867 }
never executed: }
0
868 }
never executed: }
0
869 } -
870 -
871 if (!q->updatesEnabled())
partially evaluated: !q->updatesEnabled()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:14649
0-14649
872 return;
never executed: return;
0
873 -
874 if (!childExpose.isEmpty()) {
evaluated: !childExpose.isEmpty()
TRUEFALSE
yes
Evaluation Count:14646
yes
Evaluation Count:3
3-14646
875 wbs->markDirty(childExpose, q);
executed (the execution status of this line is deduced): wbs->markDirty(childExpose, q);
-
876 isScrolled = true;
executed (the execution status of this line is deduced): isScrolled = true;
-
877 }
executed: }
Execution Count:14646
14646
878 -
879 // Instead of using native scroll-on-screen, we copy from -
880 // backingstore, giving only one screen update for each -
881 // scroll, and a solid appearance -
882 wbs->markDirtyOnScreen(destRect, q, toplevelOffset);
executed (the execution status of this line is deduced): wbs->markDirtyOnScreen(destRect, q, toplevelOffset);
-
883 }
executed: }
Execution Count:14649
14649
884} -
885 -
886static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) -
887{ -
888 if (!tlw || !tlwExtra || !tlw->testAttribute(Qt::WA_Mapped) || !tlw->isVisible())
partially evaluated: !tlw
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13107
evaluated: !tlwExtra
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:13105
evaluated: !tlw->testAttribute(Qt::WA_Mapped)
TRUEFALSE
yes
Evaluation Count:3251
yes
Evaluation Count:9854
evaluated: !tlw->isVisible()
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:9823
0-13107
889 return true;
executed: return true;
Execution Count:3284
3284
890 -
891 return false;
executed: return false;
Execution Count:9823
9823
892} -
893 -
894/*! -
895 Synchronizes the \a exposedRegion of the \a exposedWidget with the backing store. -
896 -
897 If there's nothing to repaint, the area is flushed and painting does not occur; -
898 otherwise the area is marked as dirty on screen and will be flushed right after -
899 we are done with all painting. -
900*/ -
901void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedRegion) -
902{ -
903 QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
-
904 if (discardSyncRequest(tlw, tlwExtra) || tlwExtra->inTopLevelResize)
evaluated: discardSyncRequest(tlw, tlwExtra)
TRUEFALSE
yes
Evaluation Count:31
yes
Evaluation Count:3327
partially evaluated: tlwExtra->inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3327
0-3327
905 return;
executed: return;
Execution Count:31
31
906 -
907 if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible()
partially evaluated: !exposedWidget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3327
partially evaluated: !exposedWidget->internalWinId()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3327
partially evaluated: !exposedWidget->isVisible()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3327
0-3327
908 || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) {
evaluated: !exposedWidget->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:3325
partially evaluated: exposedRegion.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3325
0-3325
909 return;
executed: return;
Execution Count:2
2
910 } -
911 -
912 // Nothing to repaint. -
913 if (!isDirty()) {
evaluated: !isDirty()
TRUEFALSE
yes
Evaluation Count:1815
yes
Evaluation Count:1510
1510-1815
914 qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset);
executed (the execution status of this line is deduced): qt_flush(exposedWidget, exposedRegion, store, tlw, tlwOffset);
-
915 return;
executed: return;
Execution Count:1815
1815
916 } -
917 -
918 if (exposedWidget != tlw)
evaluated: exposedWidget != tlw
TRUEFALSE
yes
Evaluation Count:10
yes
Evaluation Count:1500
10-1500
919 markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint()));
executed: markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint()));
Execution Count:10
10
920 else -
921 markDirtyOnScreen(exposedRegion, exposedWidget, QPoint());
executed: markDirtyOnScreen(exposedRegion, exposedWidget, QPoint());
Execution Count:1500
1500
922 sync();
executed (the execution status of this line is deduced): sync();
-
923}
executed: }
Execution Count:1510
1510
924 -
925/*! -
926 Synchronizes the backing store, i.e. dirty areas are repainted and flushed. -
927*/ -
928void QWidgetBackingStore::sync() -
929{ -
930 QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData();
-
931 if (discardSyncRequest(tlw, tlwExtra)) {
evaluated: discardSyncRequest(tlw, tlwExtra)
TRUEFALSE
yes
Evaluation Count:3248
yes
Evaluation Count:6488
3248-6488
932 // If the top-level is minimized, it's not visible on the screen so we can delay the -
933 // update until it's shown again. In order to do that we must keep the dirty states. -
934 // These will be cleared when we receive the first expose after showNormal(). -
935 // However, if the widget is not visible (isVisible() returns false), everything will -
936 // be invalidated once the widget is shown again, so clear all dirty states. -
937 if (!tlw->isVisible()) {
evaluated: !tlw->isVisible()
TRUEFALSE
yes
Evaluation Count:86
yes
Evaluation Count:3162
86-3162
938 dirty = QRegion();
executed (the execution status of this line is deduced): dirty = QRegion();
-
939 for (int i = 0; i < dirtyWidgets.size(); ++i)
partially evaluated: i < dirtyWidgets.size()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:86
0-86
940 resetWidget(dirtyWidgets.at(i));
never executed: resetWidget(dirtyWidgets.at(i));
0
941 dirtyWidgets.clear();
executed (the execution status of this line is deduced): dirtyWidgets.clear();
-
942 fullUpdatePending = false;
executed (the execution status of this line is deduced): fullUpdatePending = false;
-
943 }
executed: }
Execution Count:86
86
944 return;
executed: return;
Execution Count:3248
3248
945 } -
946 -
947 const bool updatesDisabled = !tlw->updatesEnabled();
executed (the execution status of this line is deduced): const bool updatesDisabled = !tlw->updatesEnabled();
-
948 bool repaintAllWidgets = false;
executed (the execution status of this line is deduced): bool repaintAllWidgets = false;
-
949 -
950 const bool inTopLevelResize = tlwExtra->inTopLevelResize;
executed (the execution status of this line is deduced): const bool inTopLevelResize = tlwExtra->inTopLevelResize;
-
951 const QRect tlwRect(topLevelRect());
executed (the execution status of this line is deduced): const QRect tlwRect(topLevelRect());
-
952 const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
executed (the execution status of this line is deduced): const QRect surfaceGeometry(tlwRect.topLeft(), store->size());
-
953 if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {
partially evaluated: fullUpdatePending
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6488
partially evaluated: inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6488
evaluated: surfaceGeometry.size() != tlwRect.size()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:6434
partially evaluated: !updatesDisabled
TRUEFALSE
yes
Evaluation Count:54
no
Evaluation Count:0
0-6488
954 if (hasStaticContents()) {
partially evaluated: hasStaticContents()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:54
0-54
955 // Repaint existing dirty area and newly visible area. -
956 const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
never executed (the execution status of this line is deduced): const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height());
-
957 const QRegion staticRegion(staticContents(0, clipRect));
never executed (the execution status of this line is deduced): const QRegion staticRegion(staticContents(0, clipRect));
-
958 QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
never executed (the execution status of this line is deduced): QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height());
-
959 newVisible -= staticRegion;
never executed (the execution status of this line is deduced): newVisible -= staticRegion;
-
960 dirty += newVisible;
never executed (the execution status of this line is deduced): dirty += newVisible;
-
961 store->setStaticContents(staticRegion);
never executed (the execution status of this line is deduced): store->setStaticContents(staticRegion);
-
962 } else {
never executed: }
0
963 // Repaint everything. -
964 dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
executed (the execution status of this line is deduced): dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height());
-
965 for (int i = 0; i < dirtyWidgets.size(); ++i)
evaluated: i < dirtyWidgets.size()
TRUEFALSE
yes
Evaluation Count:15
yes
Evaluation Count:54
15-54
966 resetWidget(dirtyWidgets.at(i));
executed: resetWidget(dirtyWidgets.at(i));
Execution Count:15
15
967 dirtyWidgets.clear();
executed (the execution status of this line is deduced): dirtyWidgets.clear();
-
968 repaintAllWidgets = true;
executed (the execution status of this line is deduced): repaintAllWidgets = true;
-
969 }
executed: }
Execution Count:54
54
970 } -
971 -
972 if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size())
partially evaluated: inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6488
evaluated: surfaceGeometry.size() != tlwRect.size()
TRUEFALSE
yes
Evaluation Count:54
yes
Evaluation Count:6434
0-6488
973 store->resize(tlwRect.size());
executed: store->resize(tlwRect.size());
Execution Count:54
54
974 -
975 if (updatesDisabled)
partially evaluated: updatesDisabled
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6488
0-6488
976 return;
never executed: return;
0
977 -
978 // Contains everything that needs repaint. -
979 QRegion toClean(dirty);
executed (the execution status of this line is deduced): QRegion toClean(dirty);
-
980 -
981 // Loop through all update() widgets and remove them from the list before they are -
982 // painted (in case someone calls update() in paintEvent). If the widget is opaque -
983 // and does not have transparent overlapping siblings, append it to the -
984 // opaqueNonOverlappedWidgets list and paint it directly without composition. -
985 QVarLengthArray<QWidget *, 32> opaqueNonOverlappedWidgets;
executed (the execution status of this line is deduced): QVarLengthArray<QWidget *, 32> opaqueNonOverlappedWidgets;
-
986 for (int i = 0; i < dirtyWidgets.size(); ++i) {
evaluated: i < dirtyWidgets.size()
TRUEFALSE
yes
Evaluation Count:9594
yes
Evaluation Count:6488
6488-9594
987 QWidget *w = dirtyWidgets.at(i);
executed (the execution status of this line is deduced): QWidget *w = dirtyWidgets.at(i);
-
988 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
989 if (wd->data.in_destructor)
partially evaluated: wd->data.in_destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:9594
0-9594
990 continue;
never executed: continue;
0
991 -
992 // Clip with mask() and clipRect(). -
993 wd->dirty &= wd->clipRect();
executed (the execution status of this line is deduced): wd->dirty &= wd->clipRect();
-
994 wd->clipToEffectiveMask(wd->dirty);
executed (the execution status of this line is deduced): wd->clipToEffectiveMask(wd->dirty);
-
995 -
996 // Subtract opaque siblings and children. -
997 bool hasDirtySiblingsAbove = false;
executed (the execution status of this line is deduced): bool hasDirtySiblingsAbove = false;
-
998 // We know for sure that the widget isn't overlapped if 'isMoved' is true. -
999 if (!wd->isMoved)
evaluated: !wd->isMoved
TRUEFALSE
yes
Evaluation Count:9570
yes
Evaluation Count:24
24-9570
1000 wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove);
executed: wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove);
Execution Count:9570
9570
1001 // Scrolled and moved widgets must draw all children. -
1002 if (!wd->isScrolled && !wd->isMoved)
evaluated: !wd->isScrolled
TRUEFALSE
yes
Evaluation Count:8226
yes
Evaluation Count:1368
evaluated: !wd->isMoved
TRUEFALSE
yes
Evaluation Count:8202
yes
Evaluation Count:24
24-8226
1003 wd->subtractOpaqueChildren(wd->dirty, w->rect());
executed: wd->subtractOpaqueChildren(wd->dirty, w->rect());
Execution Count:8202
8202
1004 -
1005 if (wd->dirty.isEmpty()) {
evaluated: wd->dirty.isEmpty()
TRUEFALSE
yes
Evaluation Count:579
yes
Evaluation Count:9015
579-9015
1006 resetWidget(w);
executed (the execution status of this line is deduced): resetWidget(w);
-
1007 continue;
executed: continue;
Execution Count:579
579
1008 } -
1009 -
1010 const QRegion widgetDirty(w != tlw ? wd->dirty.translated(w->mapTo(tlw, QPoint()))
executed (the execution status of this line is deduced): const QRegion widgetDirty(w != tlw ? wd->dirty.translated(w->mapTo(tlw, QPoint()))
-
1011 : wd->dirty);
executed (the execution status of this line is deduced): : wd->dirty);
-
1012 toClean += widgetDirty;
executed (the execution status of this line is deduced): toClean += widgetDirty;
-
1013 -
1014#ifndef QT_NO_GRAPHICSVIEW -
1015 if (tlw->d_func()->extra->proxyWidget) {
evaluated: tlw->d_func()->extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:9014
1-9014
1016 resetWidget(w);
executed (the execution status of this line is deduced): resetWidget(w);
-
1017 continue;
executed: continue;
Execution Count:1
1
1018 } -
1019#endif -
1020 -
1021 if (!hasDirtySiblingsAbove && wd->isOpaque && !dirty.intersects(widgetDirty.boundingRect())) {
evaluated: !hasDirtySiblingsAbove
TRUEFALSE
yes
Evaluation Count:8994
yes
Evaluation Count:20
evaluated: wd->isOpaque
TRUEFALSE
yes
Evaluation Count:7481
yes
Evaluation Count:1513
evaluated: !dirty.intersects(widgetDirty.boundingRect())
TRUEFALSE
yes
Evaluation Count:6368
yes
Evaluation Count:1113
20-8994
1022 opaqueNonOverlappedWidgets.append(w);
executed (the execution status of this line is deduced): opaqueNonOverlappedWidgets.append(w);
-
1023 } else {
executed: }
Execution Count:6368
6368
1024 resetWidget(w);
executed (the execution status of this line is deduced): resetWidget(w);
-
1025 dirty += widgetDirty;
executed (the execution status of this line is deduced): dirty += widgetDirty;
-
1026 }
executed: }
Execution Count:2646
2646
1027 } -
1028 dirtyWidgets.clear();
executed (the execution status of this line is deduced): dirtyWidgets.clear();
-
1029 -
1030 fullUpdatePending = false;
executed (the execution status of this line is deduced): fullUpdatePending = false;
-
1031 -
1032 if (toClean.isEmpty()) {
evaluated: toClean.isEmpty()
TRUEFALSE
yes
Evaluation Count:299
yes
Evaluation Count:6189
299-6189
1033 // Nothing to repaint. However, we might have newly exposed areas on the -
1034 // screen if this function was called from sync(QWidget *, QRegion)), so -
1035 // we have to make sure those are flushed. -
1036 flush();
executed (the execution status of this line is deduced): flush();
-
1037 return;
executed: return;
Execution Count:299
299
1038 } -
1039 -
1040#ifndef QT_NO_GRAPHICSVIEW -
1041 if (tlw->d_func()->extra->proxyWidget) {
evaluated: tlw->d_func()->extra->proxyWidget
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6183
6-6183
1042 updateStaticContentsSize();
executed (the execution status of this line is deduced): updateStaticContentsSize();
-
1043 dirty = QRegion();
executed (the execution status of this line is deduced): dirty = QRegion();
-
1044 const QVector<QRect> rects(toClean.rects());
executed (the execution status of this line is deduced): const QVector<QRect> rects(toClean.rects());
-
1045 for (int i = 0; i < rects.size(); ++i)
evaluated: i < rects.size()
TRUEFALSE
yes
Evaluation Count:6
yes
Evaluation Count:6
6
1046 tlw->d_func()->extra->proxyWidget->update(rects.at(i));
executed: tlw->d_func()->extra->proxyWidget->update(rects.at(i));
Execution Count:6
6
1047 return;
executed: return;
Execution Count:6
6
1048 } -
1049#endif -
1050 -
1051 BeginPaintInfo beginPaintInfo;
executed (the execution status of this line is deduced): BeginPaintInfo beginPaintInfo;
-
1052 beginPaint(toClean, tlw, store, &beginPaintInfo);
executed (the execution status of this line is deduced): beginPaint(toClean, tlw, store, &beginPaintInfo);
-
1053 if (beginPaintInfo.nothingToPaint) {
partially evaluated: beginPaintInfo.nothingToPaint
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6183
0-6183
1054 for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i)
never evaluated: i < opaqueNonOverlappedWidgets.size()
0
1055 resetWidget(opaqueNonOverlappedWidgets[i]);
never executed: resetWidget(opaqueNonOverlappedWidgets[i]);
0
1056 dirty = QRegion();
never executed (the execution status of this line is deduced): dirty = QRegion();
-
1057 return;
never executed: return;
0
1058 } -
1059 -
1060 // Must do this before sending any paint events because -
1061 // the size may change in the paint event. -
1062 updateStaticContentsSize();
executed (the execution status of this line is deduced): updateStaticContentsSize();
-
1063 const QRegion dirtyCopy(dirty);
executed (the execution status of this line is deduced): const QRegion dirtyCopy(dirty);
-
1064 dirty = QRegion();
executed (the execution status of this line is deduced): dirty = QRegion();
-
1065 -
1066 // Paint opaque non overlapped widgets. -
1067 for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) {
evaluated: i < opaqueNonOverlappedWidgets.size()
TRUEFALSE
yes
Evaluation Count:6368
yes
Evaluation Count:6183
6183-6368
1068 QWidget *w = opaqueNonOverlappedWidgets[i];
executed (the execution status of this line is deduced): QWidget *w = opaqueNonOverlappedWidgets[i];
-
1069 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
1070 -
1071 int flags = QWidgetPrivate::DrawRecursive;
executed (the execution status of this line is deduced): int flags = QWidgetPrivate::DrawRecursive;
-
1072 // Scrolled and moved widgets must draw all children. -
1073 if (!wd->isScrolled && !wd->isMoved)
evaluated: !wd->isScrolled
TRUEFALSE
yes
Evaluation Count:5044
yes
Evaluation Count:1324
evaluated: !wd->isMoved
TRUEFALSE
yes
Evaluation Count:5030
yes
Evaluation Count:14
14-5044
1074 flags |= QWidgetPrivate::DontDrawOpaqueChildren;
executed: flags |= QWidgetPrivate::DontDrawOpaqueChildren;
Execution Count:5030
5030
1075 if (w == tlw)
evaluated: w == tlw
TRUEFALSE
yes
Evaluation Count:987
yes
Evaluation Count:5381
987-5381
1076 flags |= QWidgetPrivate::DrawAsRoot;
executed: flags |= QWidgetPrivate::DrawAsRoot;
Execution Count:987
987
1077 -
1078 QRegion toBePainted(wd->dirty);
executed (the execution status of this line is deduced): QRegion toBePainted(wd->dirty);
-
1079 resetWidget(w);
executed (the execution status of this line is deduced): resetWidget(w);
-
1080 -
1081 QPoint offset(tlwOffset);
executed (the execution status of this line is deduced): QPoint offset(tlwOffset);
-
1082 if (w != tlw)
evaluated: w != tlw
TRUEFALSE
yes
Evaluation Count:5381
yes
Evaluation Count:987
987-5381
1083 offset += w->mapTo(tlw, QPoint());
executed: offset += w->mapTo(tlw, QPoint());
Execution Count:5381
5381
1084 wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this);
executed (the execution status of this line is deduced): wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this);
-
1085 }
executed: }
Execution Count:6368
6368
1086 -
1087 // Paint the rest with composition. -
1088 if (repaintAllWidgets || !dirtyCopy.isEmpty()) {
evaluated: repaintAllWidgets
TRUEFALSE
yes
Evaluation Count:49
yes
Evaluation Count:6134
evaluated: !dirtyCopy.isEmpty()
TRUEFALSE
yes
Evaluation Count:2976
yes
Evaluation Count:3158
49-6134
1089 const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
executed (the execution status of this line is deduced): const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive;
-
1090 tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this);
executed (the execution status of this line is deduced): tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this);
-
1091 }
executed: }
Execution Count:3025
3025
1092 -
1093 endPaint(toClean, store, &beginPaintInfo);
executed (the execution status of this line is deduced): endPaint(toClean, store, &beginPaintInfo);
-
1094}
executed: }
Execution Count:6183
6183
1095 -
1096/*! -
1097 Flushes the contents of the backing store into the top-level widget. -
1098 If the \a widget is non-zero, the content is flushed to the \a widget. -
1099 If the \a surface is non-zero, the content of the \a surface is flushed. -
1100*/ -
1101void QWidgetBackingStore::flush(QWidget *widget) -
1102{ -
1103 if (!dirtyOnScreen.isEmpty()) {
evaluated: !dirtyOnScreen.isEmpty()
TRUEFALSE
yes
Evaluation Count:6183
yes
Evaluation Count:299
299-6183
1104 QWidget *target = widget ? widget : tlw;
partially evaluated: widget
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6183
0-6183
1105 qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset);
executed (the execution status of this line is deduced): qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset);
-
1106 dirtyOnScreen = QRegion();
executed (the execution status of this line is deduced): dirtyOnScreen = QRegion();
-
1107 }
executed: }
Execution Count:6183
6183
1108 -
1109 if (!dirtyOnScreenWidgets || dirtyOnScreenWidgets->isEmpty())
evaluated: !dirtyOnScreenWidgets
TRUEFALSE
yes
Evaluation Count:6452
yes
Evaluation Count:30
evaluated: dirtyOnScreenWidgets->isEmpty()
TRUEFALSE
yes
Evaluation Count:14
yes
Evaluation Count:16
14-6452
1110 return;
executed: return;
Execution Count:6466
6466
1111 -
1112 for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {
evaluated: i < dirtyOnScreenWidgets->size()
TRUEFALSE
yes
Evaluation Count:23
yes
Evaluation Count:16
16-23
1113 QWidget *w = dirtyOnScreenWidgets->at(i);
executed (the execution status of this line is deduced): QWidget *w = dirtyOnScreenWidgets->at(i);
-
1114 QWidgetPrivate *wd = w->d_func();
executed (the execution status of this line is deduced): QWidgetPrivate *wd = w->d_func();
-
1115 Q_ASSERT(wd->needsFlush);
executed (the execution status of this line is deduced): qt_noop();
-
1116 qt_flush(w, *wd->needsFlush, store, tlw, tlwOffset);
executed (the execution status of this line is deduced): qt_flush(w, *wd->needsFlush, store, tlw, tlwOffset);
-
1117 *wd->needsFlush = QRegion();
executed (the execution status of this line is deduced): *wd->needsFlush = QRegion();
-
1118 }
executed: }
Execution Count:23
23
1119 dirtyOnScreenWidgets->clear();
executed (the execution status of this line is deduced): dirtyOnScreenWidgets->clear();
-
1120}
executed: }
Execution Count:16
16
1121 -
1122static inline bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra) -
1123{ -
1124 Q_ASSERT(widget);
executed (the execution status of this line is deduced): qt_noop();
-
1125 if (QApplication::closingDown())
partially evaluated: QApplication::closingDown()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:53479
0-53479
1126 return true;
never executed: return true;
0
1127 -
1128 if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore)
evaluated: !tlwExtra
TRUEFALSE
yes
Evaluation Count:10326
yes
Evaluation Count:43153
partially evaluated: tlwExtra->inTopLevelResize
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:43153
evaluated: !tlwExtra->backingStore
TRUEFALSE
yes
Evaluation Count:9684
yes
Evaluation Count:33469
0-43153
1129 return true;
executed: return true;
Execution Count:20010
20010
1130 -
1131 if (!widget->isVisible() || !widget->updatesEnabled())
evaluated: !widget->isVisible()
TRUEFALSE
yes
Evaluation Count:17273
yes
Evaluation Count:16196
evaluated: !widget->updatesEnabled()
TRUEFALSE
yes
Evaluation Count:501
yes
Evaluation Count:15695
501-17273
1132 return true;
executed: return true;
Execution Count:17774
17774
1133 -
1134 return false;
executed: return false;
Execution Count:15695
15695
1135} -
1136 -
1137/*! -
1138 Invalidates the buffer when the widget is resized. -
1139 Static areas are never invalidated unless absolutely needed. -
1140*/ -
1141void QWidgetPrivate::invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize) -
1142{ -
1143 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1144 Q_ASSERT(!q->isWindow());
executed (the execution status of this line is deduced): qt_noop();
-
1145 Q_ASSERT(q->parentWidget());
executed (the execution status of this line is deduced): qt_noop();
-
1146 -
1147 const bool staticContents = q->testAttribute(Qt::WA_StaticContents);
executed (the execution status of this line is deduced): const bool staticContents = q->testAttribute(Qt::WA_StaticContents);
-
1148 const bool sizeDecreased = (data.crect.width() < oldSize.width())
evaluated: (data.crect.width() < oldSize.width())
TRUEFALSE
yes
Evaluation Count:1065
yes
Evaluation Count:2844
1065-2844
1149 || (data.crect.height() < oldSize.height());
evaluated: (data.crect.height() < oldSize.height())
TRUEFALSE
yes
Evaluation Count:1091
yes
Evaluation Count:1753
1091-1753
1150 -
1151 const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y());
executed (the execution status of this line is deduced): const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y());
-
1152 const bool parentAreaExposed = !offset.isNull() || sizeDecreased;
evaluated: !offset.isNull()
TRUEFALSE
yes
Evaluation Count:565
yes
Evaluation Count:3344
evaluated: sizeDecreased
TRUEFALSE
yes
Evaluation Count:1793
yes
Evaluation Count:1551
565-3344
1153 const QRect newWidgetRect(q->rect());
executed (the execution status of this line is deduced): const QRect newWidgetRect(q->rect());
-
1154 const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height());
executed (the execution status of this line is deduced): const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height());
-
1155 -
1156 if (!staticContents || graphicsEffect) {
evaluated: !staticContents
TRUEFALSE
yes
Evaluation Count:3903
yes
Evaluation Count:6
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-3903
1157 QRegion staticChildren;
executed (the execution status of this line is deduced): QRegion staticChildren;
-
1158 QWidgetBackingStore *bs = 0;
executed (the execution status of this line is deduced): QWidgetBackingStore *bs = 0;
-
1159 if (offset.isNull() && (bs = maybeBackingStore()))
evaluated: offset.isNull()
TRUEFALSE
yes
Evaluation Count:3338
yes
Evaluation Count:565
partially evaluated: (bs = maybeBackingStore())
TRUEFALSE
yes
Evaluation Count:3338
no
Evaluation Count:0
0-3338
1160 staticChildren = bs->staticContents(q, oldWidgetRect);
executed: staticChildren = bs->staticContents(q, oldWidgetRect);
Execution Count:3338
3338
1161 const bool hasStaticChildren = !staticChildren.isEmpty();
executed (the execution status of this line is deduced): const bool hasStaticChildren = !staticChildren.isEmpty();
-
1162 -
1163 if (hasStaticChildren) {
partially evaluated: hasStaticChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:3903
0-3903
1164 QRegion dirty(newWidgetRect);
never executed (the execution status of this line is deduced): QRegion dirty(newWidgetRect);
-
1165 dirty -= staticChildren;
never executed (the execution status of this line is deduced): dirty -= staticChildren;
-
1166 invalidateBuffer(dirty);
never executed (the execution status of this line is deduced): invalidateBuffer(dirty);
-
1167 } else {
never executed: }
0
1168 // Entire widget needs repaint. -
1169 invalidateBuffer(newWidgetRect);
executed (the execution status of this line is deduced): invalidateBuffer(newWidgetRect);
-
1170 }
executed: }
Execution Count:3903
3903
1171 -
1172 if (!parentAreaExposed)
evaluated: !parentAreaExposed
TRUEFALSE
yes
Evaluation Count:1549
yes
Evaluation Count:2354
1549-2354
1173 return;
executed: return;
Execution Count:1549
1549
1174 -
1175 // Invalidate newly exposed area of the parent. -
1176 if (!graphicsEffect && extra && extra->hasMask) {
partially evaluated: !graphicsEffect
TRUEFALSE
yes
Evaluation Count:2354
no
Evaluation Count:0
evaluated: extra
TRUEFALSE
yes
Evaluation Count:1667
yes
Evaluation Count:687
evaluated: extra->hasMask
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:1666
0-2354
1177 QRegion parentExpose(extra->mask.translated(oldPos));
executed (the execution status of this line is deduced): QRegion parentExpose(extra->mask.translated(oldPos));
-
1178 parentExpose &= QRect(oldPos, oldSize);
executed (the execution status of this line is deduced): parentExpose &= QRect(oldPos, oldSize);
-
1179 if (hasStaticChildren)
partially evaluated: hasStaticChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:1
0-1
1180 parentExpose -= data.crect; // Offset is unchanged, safe to do this.
never executed: parentExpose -= data.crect;
0
1181 q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
executed (the execution status of this line is deduced): q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
-
1182 } else {
executed: }
Execution Count:1
1
1183 if (hasStaticChildren && !graphicsEffect) {
partially evaluated: hasStaticChildren
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2353
never evaluated: !graphicsEffect
0-2353
1184 QRegion parentExpose(QRect(oldPos, oldSize));
never executed (the execution status of this line is deduced): QRegion parentExpose(QRect(oldPos, oldSize));
-
1185 parentExpose -= data.crect; // Offset is unchanged, safe to do this.
never executed (the execution status of this line is deduced): parentExpose -= data.crect;
-
1186 q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
never executed (the execution status of this line is deduced): q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
-
1187 } else {
never executed: }
0
1188 q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize)));
executed (the execution status of this line is deduced): q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize)));
-
1189 }
executed: }
Execution Count:2353
2353
1190 } -
1191 return;
executed: return;
Execution Count:2354
2354
1192 } -
1193 -
1194 // Move static content to its new position. -
1195 if (!offset.isNull()) {
partially evaluated: !offset.isNull()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:6
0-6
1196 if (sizeDecreased) {
never evaluated: sizeDecreased
0
1197 const QSize minSize(qMin(oldSize.width(), data.crect.width()),
never executed (the execution status of this line is deduced): const QSize minSize(qMin(oldSize.width(), data.crect.width()),
-
1198 qMin(oldSize.height(), data.crect.height()));
never executed (the execution status of this line is deduced): qMin(oldSize.height(), data.crect.height()));
-
1199 moveRect(QRect(oldPos, minSize), offset.x(), offset.y());
never executed (the execution status of this line is deduced): moveRect(QRect(oldPos, minSize), offset.x(), offset.y());
-
1200 } else {
never executed: }
0
1201 moveRect(QRect(oldPos, oldSize), offset.x(), offset.y());
never executed (the execution status of this line is deduced): moveRect(QRect(oldPos, oldSize), offset.x(), offset.y());
-
1202 }
never executed: }
0
1203 } -
1204 -
1205 // Invalidate newly visible area of the widget. -
1206 if (!sizeDecreased || !oldWidgetRect.contains(newWidgetRect)) {
evaluated: !sizeDecreased
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
evaluated: !oldWidgetRect.contains(newWidgetRect)
TRUEFALSE
yes
Evaluation Count:1
yes
Evaluation Count:3
1-4
1207 QRegion newVisible(newWidgetRect);
executed (the execution status of this line is deduced): QRegion newVisible(newWidgetRect);
-
1208 newVisible -= oldWidgetRect;
executed (the execution status of this line is deduced): newVisible -= oldWidgetRect;
-
1209 invalidateBuffer(newVisible);
executed (the execution status of this line is deduced): invalidateBuffer(newVisible);
-
1210 }
executed: }
Execution Count:3
3
1211 -
1212 if (!parentAreaExposed)
evaluated: !parentAreaExposed
TRUEFALSE
yes
Evaluation Count:2
yes
Evaluation Count:4
2-4
1213 return;
executed: return;
Execution Count:2
2
1214 -
1215 // Invalidate newly exposed area of the parent. -
1216 const QRect oldRect(oldPos, oldSize);
executed (the execution status of this line is deduced): const QRect oldRect(oldPos, oldSize);
-
1217 if (extra && extra->hasMask) {
partially evaluated: extra
TRUEFALSE
yes
Evaluation Count:4
no
Evaluation Count:0
partially evaluated: extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:4
0-4
1218 QRegion parentExpose(oldRect);
never executed (the execution status of this line is deduced): QRegion parentExpose(oldRect);
-
1219 parentExpose &= extra->mask.translated(oldPos);
never executed (the execution status of this line is deduced): parentExpose &= extra->mask.translated(oldPos);
-
1220 parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect);
never executed (the execution status of this line is deduced): parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect);
-
1221 q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
never executed (the execution status of this line is deduced): q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
-
1222 } else {
never executed: }
0
1223 QRegion parentExpose(oldRect);
executed (the execution status of this line is deduced): QRegion parentExpose(oldRect);
-
1224 parentExpose -= data.crect;
executed (the execution status of this line is deduced): parentExpose -= data.crect;
-
1225 q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
executed (the execution status of this line is deduced): q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
-
1226 }
executed: }
Execution Count:4
4
1227} -
1228 -
1229/*! -
1230 Invalidates the \a rgn (in widget's coordinates) of the backing store, i.e. -
1231 all widgets intersecting with the region will be repainted when the backing store -
1232 is synced. -
1233 -
1234 ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -
1235*/ -
1236void QWidgetPrivate::invalidateBuffer(const QRegion &rgn) -
1237{ -
1238 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1239 -
1240 QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
-
1241 if (discardInvalidateBufferRequest(q, tlwExtra) || rgn.isEmpty())
evaluated: discardInvalidateBufferRequest(q, tlwExtra)
TRUEFALSE
yes
Evaluation Count:1917
yes
Evaluation Count:2558
evaluated: rgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:270
yes
Evaluation Count:2288
270-2558
1242 return;
executed: return;
Execution Count:2187
2187
1243 -
1244 QRegion wrgn(rgn);
executed (the execution status of this line is deduced): QRegion wrgn(rgn);
-
1245 wrgn &= clipRect();
executed (the execution status of this line is deduced): wrgn &= clipRect();
-
1246 if (!graphicsEffect && extra && extra->hasMask)
partially evaluated: !graphicsEffect
TRUEFALSE
yes
Evaluation Count:2288
no
Evaluation Count:0
evaluated: extra
TRUEFALSE
yes
Evaluation Count:2265
yes
Evaluation Count:23
partially evaluated: extra->hasMask
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:2265
0-2288
1247 wrgn &= extra->mask;
never executed: wrgn &= extra->mask;
0
1248 if (wrgn.isEmpty())
evaluated: wrgn.isEmpty()
TRUEFALSE
yes
Evaluation Count:193
yes
Evaluation Count:2095
193-2095
1249 return;
executed: return;
Execution Count:193
193
1250 -
1251 tlwExtra->backingStoreTracker->markDirty(wrgn, q, false, true);
executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(wrgn, q, false, true);
-
1252}
executed: }
Execution Count:2095
2095
1253 -
1254/*! -
1255 This function is equivalent to calling invalidateBuffer(QRegion(rect), ...), but -
1256 is more efficient as it eliminates QRegion operations/allocations and can -
1257 use the rect more precisely for additional cut-offs. -
1258 -
1259 ### Qt 4.6: Merge into a template function (after MSVC isn't supported anymore). -
1260*/ -
1261void QWidgetPrivate::invalidateBuffer(const QRect &rect) -
1262{ -
1263 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1264 -
1265 QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
executed (the execution status of this line is deduced): QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData();
-
1266 if (discardInvalidateBufferRequest(q, tlwExtra) || rect.isEmpty())
evaluated: discardInvalidateBufferRequest(q, tlwExtra)
TRUEFALSE
yes
Evaluation Count:35867
yes
Evaluation Count:13137
evaluated: rect.isEmpty()
TRUEFALSE
yes
Evaluation Count:382
yes
Evaluation Count:12755
382-35867
1267 return;
executed: return;
Execution Count:36249
36249
1268 -
1269 QRect wRect(rect);
executed (the execution status of this line is deduced): QRect wRect(rect);
-
1270 wRect &= clipRect();
executed (the execution status of this line is deduced): wRect &= clipRect();
-
1271 if (wRect.isEmpty())
evaluated: wRect.isEmpty()
TRUEFALSE
yes
Evaluation Count:107
yes
Evaluation Count:12648
107-12648
1272 return;
executed: return;
Execution Count:107
107
1273 -
1274 if (graphicsEffect || !extra || !extra->hasMask) {
partially evaluated: graphicsEffect
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:12648
evaluated: !extra
TRUEFALSE
yes
Evaluation Count:2435
yes
Evaluation Count:10213
evaluated: !extra->hasMask
TRUEFALSE
yes
Evaluation Count:10160
yes
Evaluation Count:53
0-12648
1275 tlwExtra->backingStoreTracker->markDirty(wRect, q, false, true);
executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(wRect, q, false, true);
-
1276 return;
executed: return;
Execution Count:12595
12595
1277 } -
1278 -
1279 QRegion wRgn(extra->mask);
executed (the execution status of this line is deduced): QRegion wRgn(extra->mask);
-
1280 wRgn &= wRect;
executed (the execution status of this line is deduced): wRgn &= wRect;
-
1281 if (wRgn.isEmpty())
partially evaluated: wRgn.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:53
0-53
1282 return;
never executed: return;
0
1283 -
1284 tlwExtra->backingStoreTracker->markDirty(wRgn, q, false, true);
executed (the execution status of this line is deduced): tlwExtra->backingStoreTracker->markDirty(wRgn, q, false, true);
-
1285}
executed: }
Execution Count:53
53
1286 -
1287void QWidgetPrivate::repaint_sys(const QRegion &rgn) -
1288{ -
1289 if (data.in_destructor)
partially evaluated: data.in_destructor
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:13
0-13
1290 return;
never executed: return;
0
1291 -
1292 Q_Q(QWidget);
executed (the execution status of this line is deduced): QWidget * const q = q_func();
-
1293 if (discardSyncRequest(q, maybeTopData()))
evaluated: discardSyncRequest(q, maybeTopData())
TRUEFALSE
yes
Evaluation Count:5
yes
Evaluation Count:8
5-8
1294 return;
executed: return;
Execution Count:5
5
1295 -
1296 if (q->testAttribute(Qt::WA_StaticContents)) {
partially evaluated: q->testAttribute(Qt::WA_StaticContents)
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1297 if (!extra)
never evaluated: !extra
0
1298 createExtra();
never executed: createExtra();
0
1299 extra->staticContentsSize = data.crect.size();
never executed (the execution status of this line is deduced): extra->staticContentsSize = data.crect.size();
-
1300 }
never executed: }
0
1301 -
1302 QPaintEngine *engine = q->paintEngine();
executed (the execution status of this line is deduced): QPaintEngine *engine = q->paintEngine();
-
1303 -
1304 // QGLWidget does not support partial updates if: -
1305 // 1) The context is double buffered -
1306 // 2) The context is single buffered and auto-fill background is enabled. -
1307 const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL
partially evaluated: engine
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
never evaluated: engine->type() == QPaintEngine::OpenGL
0-8
1308 || engine->type() == QPaintEngine::OpenGL2))
never evaluated: engine->type() == QPaintEngine::OpenGL2
0
1309 && (usesDoubleBufferedGLContext || q->autoFillBackground());
never evaluated: usesDoubleBufferedGLContext
never evaluated: q->autoFillBackground()
0
1310 QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn);
executed (the execution status of this line is deduced): QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn);
-
1311 -
1312#ifdef Q_WS_MAC -
1313 // No difference between update() and repaint() on the Mac. -
1314 update_sys(toBePainted); -
1315 return; -
1316#endif -
1317 -
1318 toBePainted &= clipRect();
executed (the execution status of this line is deduced): toBePainted &= clipRect();
-
1319 clipToEffectiveMask(toBePainted);
executed (the execution status of this line is deduced): clipToEffectiveMask(toBePainted);
-
1320 if (toBePainted.isEmpty())
partially evaluated: toBePainted.isEmpty()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1321 return; // Nothing to repaint.
never executed: return;
0
1322 -
1323#ifndef QT_NO_PAINT_DEBUG -
1324 bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); -
1325#endif -
1326 -
1327 drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0);
executed (the execution status of this line is deduced): drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0);
-
1328 -
1329#ifndef QT_NO_PAINT_DEBUG -
1330 if (flushed) -
1331 QWidgetBackingStore::unflushPaint(q, toBePainted); -
1332#endif -
1333 -
1334 if (q->paintingActive())
partially evaluated: q->paintingActive()
TRUEFALSE
no
Evaluation Count:0
yes
Evaluation Count:8
0-8
1335 qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
never executed: QMessageLogger("kernel/qwidgetbackingstore.cpp", 1335, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent");
0
1336}
executed: }
Execution Count:8
8
1337 -
1338 -
1339QT_END_NAMESPACE -
1340 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial