Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | | - |
41 | #include "qplatformdefs.h" | - |
42 | | - |
43 | #include "qwidgetbackingstore_p.h" | - |
44 | | - |
45 | #include <QtCore/qglobal.h> | - |
46 | #include <QtCore/qdebug.h> | - |
47 | #include <QtCore/qvarlengtharray.h> | - |
48 | #include <QtGui/qevent.h> | - |
49 | #include <QtWidgets/qapplication.h> | - |
50 | #include <QtGui/qpaintengine.h> | - |
51 | #include <QtWidgets/qgraphicsproxywidget.h> | - |
52 | | - |
53 | #include <private/qwidget_p.h> | - |
54 | #include <private/qapplication_p.h> | - |
55 | #include <private/qpaintengine_raster_p.h> | - |
56 | #include <private/qgraphicseffect_p.h> | - |
57 | #include <QtGui/private/qwindow_p.h> | - |
58 | | - |
59 | #include <qpa/qplatformbackingstore.h> | - |
60 | | - |
61 | #if defined(Q_OS_WIN) && !defined(QT_NO_PAINT_DEBUG) | - |
62 | # include <QtCore/qt_windows.h> | - |
63 | # include <qpa/qplatformnativeinterface.h> | - |
64 | #endif | - |
65 | | - |
66 | QT_BEGIN_NAMESPACE | - |
67 | | - |
68 | extern QRegion qt_dirtyRegion(QWidget *); | - |
69 | | - |
70 | #ifndef QT_NO_OPENGL | - |
71 | Q_GLOBAL_STATIC(QPlatformTextureList, qt_dummy_platformTextureList) never executed: end of block never executed: guard.store(QtGlobalStatic::Destroyed); never executed: return &holder.value; TRUE | never evaluated | FALSE | never evaluated |
| 0 |
72 | #endif | - |
73 | | - |
74 | | - |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, | - |
80 | QWidget *tlw, const QPoint &tlwOffset, QPlatformTextureList *widgetTextures, | - |
81 | QWidgetBackingStore *widgetBackingStore) | - |
82 | { | - |
83 | #ifdef QT_NO_OPENGL | - |
84 | Q_UNUSED(widgetTextures); | - |
85 | Q_ASSERT(!region.isEmpty()); | - |
86 | #else | - |
87 | Q_ASSERT(!region.isEmpty() || widgetTextures); | - |
88 | #endif | - |
89 | Q_ASSERT(widget); | - |
90 | Q_ASSERT(backingStore); | - |
91 | Q_ASSERT(tlw); | - |
92 | #if !defined(QT_NO_PAINT_DEBUG) | - |
93 | static int flushUpdate = qEnvironmentVariableIntValue("QT_FLUSH_UPDATE"); | - |
94 | if (flushUpdate > 0)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
95 | QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); never executed: QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); | 0 |
96 | #endif | - |
97 | | - |
98 | if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
99 | return; never executed: return; | 0 |
100 | static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS"); | - |
101 | if (fpsDebug) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
102 | if (!widgetBackingStore->perfFrames++)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
103 | widgetBackingStore->perfTime.start(); never executed: widgetBackingStore->perfTime.start(); | 0 |
104 | if (widgetBackingStore->perfTime.elapsed() > 5000) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
105 | double fps = double(widgetBackingStore->perfFrames * 1000) / widgetBackingStore->perfTime.restart(); | - |
106 | qDebug("FPS: %.1f\n", fps); | - |
107 | widgetBackingStore->perfFrames = 0; | - |
108 | } never executed: end of block | 0 |
109 | } never executed: end of block | 0 |
110 | | - |
111 | QPoint offset = tlwOffset; | - |
112 | if (widget != tlw)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
113 | offset += widget->mapTo(tlw, QPoint()); never executed: offset += widget->mapTo(tlw, QPoint()); | 0 |
114 | | - |
115 | QRegion effectiveRegion = region; | - |
116 | #ifndef QT_NO_OPENGL | - |
117 | const bool compositionWasActive = widget->d_func()->renderToTextureComposeActive; | - |
118 | if (!widgetTextures) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
119 | widget->d_func()->renderToTextureComposeActive = false; | - |
120 | | - |
121 | | - |
122 | | - |
123 | | - |
124 | if (compositionWasActive)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
125 | widgetTextures = qt_dummy_platformTextureList; never executed: widgetTextures = qt_dummy_platformTextureList; | 0 |
126 | } else { never executed: end of block | 0 |
127 | widget->d_func()->renderToTextureComposeActive = true; | - |
128 | } never executed: end of block | 0 |
129 | | - |
130 | | - |
131 | | - |
132 | if (compositionWasActive != widget->d_func()->renderToTextureComposeActive)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
133 | effectiveRegion = widget->rect(); never executed: effectiveRegion = widget->rect(); | 0 |
134 | | - |
135 | | - |
136 | if (widgetTextures) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
137 | qt_window_private(tlw->windowHandle())->compositing = true; | - |
138 | widget->window()->d_func()->sendComposeStatus(widget->window(), false); | - |
139 | | - |
140 | | - |
141 | | - |
142 | const bool translucentBackground = widget->testAttribute(Qt::WA_TranslucentBackground); | - |
143 | | - |
144 | | - |
145 | backingStore->handle()->composeAndFlush(widget->windowHandle(), effectiveRegion, offset, widgetTextures, | - |
146 | tlw->d_func()->shareContext(), translucentBackground); | - |
147 | widget->window()->d_func()->sendComposeStatus(widget->window(), true); | - |
148 | } else never executed: end of block | 0 |
149 | #endif | - |
150 | backingStore->flush(effectiveRegion, widget->windowHandle(), offset); never executed: backingStore->flush(effectiveRegion, widget->windowHandle(), offset); | 0 |
151 | } | - |
152 | | - |
153 | #ifndef QT_NO_PAINT_DEBUG | - |
154 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) | - |
155 | | - |
156 | static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec) | - |
157 | { | - |
158 | | - |
159 | QWindow *nativeWindow = widget->windowHandle(); | - |
160 | if (!nativeWindow) | - |
161 | return; | - |
162 | void *hdcV = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("getDC"), nativeWindow); | - |
163 | if (!hdcV) | - |
164 | return; | - |
165 | const HDC hdc = reinterpret_cast<HDC>(hdcV); | - |
166 | | - |
167 | HBRUSH brush; | - |
168 | static int i = 0; | - |
169 | switch (i) { | - |
170 | case 0: | - |
171 | brush = CreateSolidBrush(RGB(255, 255, 0)); | - |
172 | break; | - |
173 | case 1: | - |
174 | brush = CreateSolidBrush(RGB(255, 200, 55)); | - |
175 | break; | - |
176 | case 2: | - |
177 | brush = CreateSolidBrush(RGB(200, 255, 55)); | - |
178 | break; | - |
179 | case 3: | - |
180 | brush = CreateSolidBrush(RGB(200, 200, 0)); | - |
181 | break; | - |
182 | } | - |
183 | i = (i + 1) & 3; | - |
184 | | - |
185 | foreach (const QRect &rect, region.rects()) { | - |
186 | RECT winRect; | - |
187 | SetRect(&winRect, rect.left(), rect.top(), rect.right(), rect.bottom()); | - |
188 | FillRect(hdc, &winRect, brush); | - |
189 | } | - |
190 | DeleteObject(brush); | - |
191 | QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("releaseDC"), nativeWindow); | - |
192 | ::Sleep(msec); | - |
193 | } | - |
194 | #endif // defined(Q_OS_WIN) && !defined(Q_OS_WINRT) | - |
195 | | - |
196 | void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) | - |
197 | { | - |
198 | #ifdef Q_OS_WINRT | - |
199 | Q_UNUSED(msec) | - |
200 | #endif | - |
201 | QRegion paintRegion = toBePainted; | - |
202 | QRect widgetRect = widget->rect(); | - |
203 | | - |
204 | if (!widget->internalWinId()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
205 | QWidget *nativeParent = widget->nativeParentWidget(); | - |
206 | const QPoint offset = widget->mapTo(nativeParent, QPoint(0, 0)); | - |
207 | paintRegion.translate(offset); | - |
208 | widgetRect.translate(offset); | - |
209 | widget = nativeParent; | - |
210 | } never executed: end of block | 0 |
211 | | - |
212 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) | - |
213 | Q_UNUSED(unclipped); | - |
214 | showYellowThing_win(widget, paintRegion, msec); | - |
215 | #else | - |
216 | | - |
217 | bool paintUnclipped = widget->testAttribute(Qt::WA_PaintUnclipped); | - |
218 | if (unclipped && !widget->d_func()->paintOnScreen())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
219 | widget->setAttribute(Qt::WA_PaintUnclipped); never executed: widget->setAttribute(Qt::WA_PaintUnclipped); | 0 |
220 | | - |
221 | const bool setFlag = !widget->testAttribute(Qt::WA_WState_InPaintEvent); | - |
222 | if (setFlag)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
223 | widget->setAttribute(Qt::WA_WState_InPaintEvent); never executed: widget->setAttribute(Qt::WA_WState_InPaintEvent); | 0 |
224 | | - |
225 | | - |
226 | QPaintEngine *pe = widget->paintEngine(); | - |
227 | if (pe) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
228 | pe->setSystemClip(paintRegion); | - |
229 | { | - |
230 | QPainter p(widget); | - |
231 | p.setClipRegion(paintRegion); | - |
232 | static int i = 0; | - |
233 | switch (i) { | - |
234 | case 0: never executed: case 0: | 0 |
235 | p.fillRect(widgetRect, QColor(255,255,0)); | - |
236 | break; never executed: break; | 0 |
237 | case 1: never executed: case 1: | 0 |
238 | p.fillRect(widgetRect, QColor(255,200,55)); | - |
239 | break; never executed: break; | 0 |
240 | case 2: never executed: case 2: | 0 |
241 | p.fillRect(widgetRect, QColor(200,255,55)); | - |
242 | break; never executed: break; | 0 |
243 | case 3: never executed: case 3: | 0 |
244 | p.fillRect(widgetRect, QColor(200,200,0)); | - |
245 | break; never executed: break; | 0 |
246 | } | - |
247 | i = (i+1) & 3; | - |
248 | p.end(); | - |
249 | } | - |
250 | } never executed: end of block | 0 |
251 | | - |
252 | if (setFlag)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
253 | widget->setAttribute(Qt::WA_WState_InPaintEvent, false); never executed: widget->setAttribute(Qt::WA_WState_InPaintEvent, false); | 0 |
254 | | - |
255 | | - |
256 | widget->setAttribute(Qt::WA_PaintUnclipped, paintUnclipped); | - |
257 | | - |
258 | if (pe)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
259 | pe->setSystemClip(QRegion()); never executed: pe->setSystemClip(QRegion()); | 0 |
260 | | - |
261 | #if defined(Q_OS_UNIX) | - |
262 | ::usleep(1000 * msec); | - |
263 | #endif | - |
264 | #endif // !Q_OS_WIN | - |
265 | } never executed: end of block | 0 |
266 | | - |
267 | bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) | - |
268 | { | - |
269 | if (!widget)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
270 | return false; never executed: return false; | 0 |
271 | | - |
272 | int delay = 0; | - |
273 | if (widget->testAttribute(Qt::WA_WState_InPaintEvent)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
274 | static int flushPaintEvent = qEnvironmentVariableIntValue("QT_FLUSH_PAINT_EVENT"); | - |
275 | if (!flushPaintEvent)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
276 | return false; never executed: return false; | 0 |
277 | delay = flushPaintEvent; | - |
278 | } else { never executed: end of block | 0 |
279 | static int flushPaint = qEnvironmentVariableIntValue("QT_FLUSH_PAINT"); | - |
280 | if (!flushPaint)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
281 | return false; never executed: return false; | 0 |
282 | delay = flushPaint; | - |
283 | } never executed: end of block | 0 |
284 | | - |
285 | QWidgetBackingStore::showYellowThing(widget, rgn, delay * 10, true); | - |
286 | return true; never executed: return true; | 0 |
287 | } | - |
288 | | - |
289 | void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) | - |
290 | { | - |
291 | if (widget->d_func()->paintOnScreen() || rgn.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
292 | return; never executed: return; | 0 |
293 | | - |
294 | QWidget *tlw = widget->window(); | - |
295 | QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); | - |
296 | if (!tlwExtra)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
297 | return; never executed: return; | 0 |
298 | | - |
299 | const QPoint offset = widget->mapTo(tlw, QPoint()); | - |
300 | qt_flush(widget, rgn, tlwExtra->backingStoreTracker->store, tlw, offset, 0, tlw->d_func()->maybeBackingStore()); | - |
301 | } never executed: end of block | 0 |
302 | #endif // QT_NO_PAINT_DEBUG | - |
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) | - |
309 | { | - |
310 | const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); | - |
311 | const QRect tlwRect(QRect(pos, rect.size())); | - |
312 | if (fullUpdatePending || dirty.intersects(tlwRect))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
313 | return false; never executed: return false; | 0 |
314 | return store->scroll(tlwRect, dx, dy); never executed: return store->scroll(tlwRect, dx, dy); | 0 |
315 | } | - |
316 | | - |
317 | void QWidgetBackingStore::releaseBuffer() | - |
318 | { | - |
319 | if (store)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
320 | store->resize(QSize()); never executed: store->resize(QSize()); | 0 |
321 | } never executed: end of block | 0 |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, | - |
330 | BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates) | - |
331 | { | - |
332 | Q_UNUSED(widget); | - |
333 | Q_UNUSED(toCleanIsInTopLevelCoordinates); | - |
334 | | - |
335 | | - |
336 | dirtyOnScreen += toClean; | - |
337 | | - |
338 | #ifdef QT_NO_PAINT_DEBUG | - |
339 | backingStore->beginPaint(toClean); | - |
340 | #else | - |
341 | returnInfo->wasFlushed = QWidgetBackingStore::flushPaint(tlw, toClean); | - |
342 | | - |
343 | | - |
344 | | - |
345 | | - |
346 | if (!returnInfo->wasFlushed)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
347 | backingStore->beginPaint(toClean); never executed: backingStore->beginPaint(toClean); | 0 |
348 | #endif | - |
349 | | - |
350 | Q_UNUSED(returnInfo); | - |
351 | } never executed: end of block | 0 |
352 | | - |
353 | void QWidgetBackingStore::endPaint(const QRegion &cleaned, QBackingStore *backingStore, | - |
354 | BeginPaintInfo *beginPaintInfo) | - |
355 | { | - |
356 | #ifndef QT_NO_PAINT_DEBUG | - |
357 | if (!beginPaintInfo->wasFlushed)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
358 | backingStore->endPaint(); never executed: backingStore->endPaint(); | 0 |
359 | else | - |
360 | QWidgetBackingStore::unflushPaint(tlw, cleaned); never executed: QWidgetBackingStore::unflushPaint(tlw, cleaned); | 0 |
361 | #else | - |
362 | Q_UNUSED(beginPaintInfo); | - |
363 | Q_UNUSED(cleaned); | - |
364 | backingStore->endPaint(); | - |
365 | #endif | - |
366 | | - |
367 | flush(); | - |
368 | } never executed: end of block | 0 |
369 | | - |
370 | | - |
371 | | - |
372 | | - |
373 | | - |
374 | | - |
375 | | - |
376 | QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const | - |
377 | { | - |
378 | const bool widgetDirty = widget && widget != tlw;TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
379 | const QRect tlwRect(topLevelRect()); | - |
380 | const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); | - |
381 | if (fullUpdatePending || (surfaceGeometry != tlwRect && surfaceGeometry.size() != tlwRect.size())) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
382 | if (widgetDirty) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
383 | const QRect dirtyTlwRect = QRect(QPoint(), tlwRect.size()); | - |
384 | const QPoint offset(widget->mapTo(tlw, QPoint())); | - |
385 | const QRect dirtyWidgetRect(dirtyTlwRect & widget->rect().translated(offset)); | - |
386 | return dirtyWidgetRect.translated(-offset); never executed: return dirtyWidgetRect.translated(-offset); | 0 |
387 | } | - |
388 | return QRect(QPoint(), tlwRect.size()); never executed: return QRect(QPoint(), tlwRect.size()); | 0 |
389 | } | - |
390 | | - |
391 | | - |
392 | QRegion r(dirty); | - |
393 | for (int i = 0; i < dirtyWidgets.size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
394 | QWidget *w = dirtyWidgets.at(i); | - |
395 | if (widgetDirty && w != widget && !widget->isAncestorOf(w))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
396 | continue; never executed: continue; | 0 |
397 | r += w->d_func()->dirty.translated(w->mapTo(tlw, QPoint())); | - |
398 | } never executed: end of block | 0 |
399 | | - |
400 | | - |
401 | r += dirtyOnScreen; | - |
402 | | - |
403 | if (dirtyOnScreenWidgets) { TRUE | never evaluated | FALSE | never evaluated |
| 0 |
404 | for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
405 | QWidget *w = dirtyOnScreenWidgets->at(i); | - |
406 | if (widgetDirty && w != widget && !widget->isAncestorOf(w))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
407 | continue; never executed: continue; | 0 |
408 | QWidgetPrivate *wd = w->d_func(); | - |
409 | Q_ASSERT(wd->needsFlush); | - |
410 | r += wd->needsFlush->translated(w->mapTo(tlw, QPoint())); | - |
411 | } never executed: end of block | 0 |
412 | } never executed: end of block | 0 |
413 | | - |
414 | if (widgetDirty) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
415 | | - |
416 | const QPoint offset(widget->mapTo(tlw, QPoint())); | - |
417 | r &= widget->rect().translated(offset); | - |
418 | r.translate(-offset); | - |
419 | } never executed: end of block | 0 |
420 | return r; never executed: return r; | 0 |
421 | } | - |
422 | | - |
423 | | - |
424 | | - |
425 | | - |
426 | | - |
427 | | - |
428 | QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const | - |
429 | { | - |
430 | if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
431 | const QSize surfaceGeometry(store->size()); | - |
432 | QRect surfaceRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); | - |
433 | if (!withinClipRect.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
434 | surfaceRect &= withinClipRect; never executed: surfaceRect &= withinClipRect; | 0 |
435 | return QRegion(surfaceRect); never executed: return QRegion(surfaceRect); | 0 |
436 | } | - |
437 | | - |
438 | QRegion region; | - |
439 | if (parent && parent->d_func()->children.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
440 | return region; never executed: return region; | 0 |
441 | | - |
442 | const bool clipToRect = !withinClipRect.isEmpty(); | - |
443 | const int count = staticWidgets.count(); | - |
444 | for (int i = 0; i < count; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
445 | QWidget *w = staticWidgets.at(i); | - |
446 | QWidgetPrivate *wd = w->d_func(); | - |
447 | if (!wd->isOpaque || !wd->extra || wd->extra->staticContentsSize.isEmpty()TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
448 | || !w->isVisible() || (parent && !parent->isAncestorOf(w))) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
449 | continue; never executed: continue; | 0 |
450 | } | - |
451 | | - |
452 | QRect rect(0, 0, wd->extra->staticContentsSize.width(), wd->extra->staticContentsSize.height()); | - |
453 | const QPoint offset = w->mapTo(parent ? parent : tlw, QPoint()); | - |
454 | if (clipToRect)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
455 | rect &= withinClipRect.translated(-offset); never executed: rect &= withinClipRect.translated(-offset); | 0 |
456 | if (rect.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
457 | continue; never executed: continue; | 0 |
458 | | - |
459 | rect &= wd->clipRect(); | - |
460 | if (rect.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
461 | continue; never executed: continue; | 0 |
462 | | - |
463 | QRegion visible(rect); | - |
464 | wd->clipToEffectiveMask(visible); | - |
465 | if (visible.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
466 | continue; never executed: continue; | 0 |
467 | wd->subtractOpaqueSiblings(visible, 0, true); | - |
468 | | - |
469 | visible.translate(offset); | - |
470 | region += visible; | - |
471 | } never executed: end of block | 0 |
472 | | - |
473 | return region; never executed: return region; | 0 |
474 | } | - |
475 | | - |
476 | void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, UpdateTime updateTime) | - |
477 | { | - |
478 | if (!widget)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
479 | return; never executed: return; | 0 |
480 | | - |
481 | #ifndef QT_NO_OPENGL | - |
482 | | - |
483 | | - |
484 | | - |
485 | | - |
486 | QWidget *w = widget->window(); | - |
487 | if (updateTime == UpdateNow && w && w->windowHandle() && QWindowPrivate::get(w->windowHandle())->compositing) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
488 | int refresh = 60; | - |
489 | QScreen *ws = w->windowHandle()->screen(); | - |
490 | if (ws)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
491 | refresh = ws->refreshRate(); never executed: refresh = ws->refreshRate(); | 0 |
492 | QWindowPrivate *wd = QWindowPrivate::get(w->windowHandle()); | - |
493 | if (wd->lastComposeTime.isValid()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
494 | const qint64 elapsed = wd->lastComposeTime.elapsed(); | - |
495 | if (elapsed <= qint64(1000.0f / refresh))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
496 | updateTime = UpdateLater; never executed: updateTime = UpdateLater; | 0 |
497 | } never executed: end of block | 0 |
498 | } never executed: end of block | 0 |
499 | #endif | - |
500 | | - |
501 | switch (updateTime) { | - |
502 | case UpdateLater: never executed: case UpdateLater: | 0 |
503 | updateRequestSent = true; | - |
504 | QApplication::postEvent(widget, new QEvent(QEvent::UpdateRequest), Qt::LowEventPriority); | - |
505 | break; never executed: break; | 0 |
506 | case UpdateNow: { never executed: case UpdateNow: | 0 |
507 | QEvent event(QEvent::UpdateRequest); | - |
508 | QApplication::sendEvent(widget, &event); | - |
509 | break; never executed: break; | 0 |
510 | } | - |
511 | } | - |
512 | } never executed: end of block | 0 |
513 | | - |
514 | | - |
515 | | - |
516 | | - |
517 | | - |
518 | | - |
519 | | - |
520 | | - |
521 | | - |
522 | | - |
523 | | - |
524 | | - |
525 | | - |
526 | | - |
527 | void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, | - |
528 | UpdateTime updateTime, BufferState bufferState) | - |
529 | { | - |
530 | Q_ASSERT(tlw->d_func()->extra); | - |
531 | Q_ASSERT(tlw->d_func()->extra->topextra); | - |
532 | Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); | - |
533 | Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); | - |
534 | Q_ASSERT(widget->window() == tlw); | - |
535 | Q_ASSERT(!rgn.isEmpty()); | - |
536 | | - |
537 | #ifndef QT_NO_GRAPHICSEFFECT | - |
538 | widget->d_func()->invalidateGraphicsEffectsRecursively(); | - |
539 | #endif //QT_NO_GRAPHICSEFFECT | - |
540 | | - |
541 | if (widget->d_func()->paintOnScreen()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
542 | if (widget->d_func()->dirty.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
543 | widget->d_func()->dirty = rgn; | - |
544 | sendUpdateRequest(widget, updateTime); | - |
545 | return; never executed: return; | 0 |
546 | } else if (qt_region_strictContains(widget->d_func()->dirty, widget->rect())) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
547 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
548 | sendUpdateRequest(widget, updateTime); never executed: sendUpdateRequest(widget, updateTime); | 0 |
549 | return; never executed: return; | 0 |
550 | } | - |
551 | | - |
552 | const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); | - |
553 | widget->d_func()->dirty += rgn; | - |
554 | if (!eventAlreadyPosted || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
555 | sendUpdateRequest(widget, updateTime); never executed: sendUpdateRequest(widget, updateTime); | 0 |
556 | return; never executed: return; | 0 |
557 | } | - |
558 | | - |
559 | | - |
560 | if (fullUpdatePending) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
561 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
562 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
563 | return; never executed: return; | 0 |
564 | } | - |
565 | | - |
566 | const QPoint offset = widget->mapTo(tlw, QPoint()); | - |
567 | | - |
568 | if (QWidgetPrivate::get(widget)->renderToTexture) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
569 | if (!widget->d_func()->inDirtyList)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
570 | addDirtyRenderToTextureWidget(widget); never executed: addDirtyRenderToTextureWidget(widget); | 0 |
571 | if (!updateRequestSent || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
572 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
573 | return; never executed: return; | 0 |
574 | } | - |
575 | | - |
576 | const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect()); | - |
577 | if (qt_region_strictContains(dirty, widgetRect.translated(offset))) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
578 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
579 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
580 | return; never executed: return; | 0 |
581 | } | - |
582 | | - |
583 | if (bufferState == BufferInvalid) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
584 | const bool eventAlreadyPosted = !dirty.isEmpty() || updateRequestSent;TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
585 | #ifndef QT_NO_GRAPHICSEFFECT | - |
586 | if (widget->d_func()->graphicsEffect)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
587 | dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); never executed: dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); | 0 |
588 | else | - |
589 | #endif //QT_NO_GRAPHICSEFFECT | - |
590 | dirty += rgn.translated(offset); never executed: dirty += rgn.translated(offset); | 0 |
591 | if (!eventAlreadyPosted || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
592 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
593 | return; never executed: return; | 0 |
594 | } | - |
595 | | - |
596 | if (dirtyWidgets.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
597 | addDirtyWidget(widget, rgn); | - |
598 | sendUpdateRequest(tlw, updateTime); | - |
599 | return; never executed: return; | 0 |
600 | } | - |
601 | | - |
602 | if (widget->d_func()->inDirtyList) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
603 | if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
604 | #ifndef QT_NO_GRAPHICSEFFECT | - |
605 | if (widget->d_func()->graphicsEffect)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
606 | widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); never executed: widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); | 0 |
607 | else | - |
608 | #endif //QT_NO_GRAPHICSEFFECT | - |
609 | widget->d_func()->dirty += rgn; never executed: widget->d_func()->dirty += rgn; | 0 |
610 | } | - |
611 | } else { never executed: end of block | 0 |
612 | addDirtyWidget(widget, rgn); | - |
613 | } never executed: end of block | 0 |
614 | | - |
615 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
616 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
617 | } never executed: end of block | 0 |
618 | | - |
619 | | - |
620 | | - |
621 | | - |
622 | | - |
623 | | - |
624 | | - |
625 | | - |
626 | void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, | - |
627 | UpdateTime updateTime, BufferState bufferState) | - |
628 | { | - |
629 | Q_ASSERT(tlw->d_func()->extra); | - |
630 | Q_ASSERT(tlw->d_func()->extra->topextra); | - |
631 | Q_ASSERT(!tlw->d_func()->extra->topextra->inTopLevelResize); | - |
632 | Q_ASSERT(widget->isVisible() && widget->updatesEnabled()); | - |
633 | Q_ASSERT(widget->window() == tlw); | - |
634 | Q_ASSERT(!rect.isEmpty()); | - |
635 | | - |
636 | #ifndef QT_NO_GRAPHICSEFFECT | - |
637 | widget->d_func()->invalidateGraphicsEffectsRecursively(); | - |
638 | #endif //QT_NO_GRAPHICSEFFECT | - |
639 | | - |
640 | if (widget->d_func()->paintOnScreen()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
641 | if (widget->d_func()->dirty.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
642 | widget->d_func()->dirty = QRegion(rect); | - |
643 | sendUpdateRequest(widget, updateTime); | - |
644 | return; never executed: return; | 0 |
645 | } else if (qt_region_strictContains(widget->d_func()->dirty, rect)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
646 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
647 | sendUpdateRequest(widget, updateTime); never executed: sendUpdateRequest(widget, updateTime); | 0 |
648 | return; never executed: return; | 0 |
649 | } | - |
650 | | - |
651 | const bool eventAlreadyPosted = !widget->d_func()->dirty.isEmpty(); | - |
652 | widget->d_func()->dirty += rect; | - |
653 | if (!eventAlreadyPosted || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
654 | sendUpdateRequest(widget, updateTime); never executed: sendUpdateRequest(widget, updateTime); | 0 |
655 | return; never executed: return; | 0 |
656 | } | - |
657 | | - |
658 | if (fullUpdatePending) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
659 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
660 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
661 | return; never executed: return; | 0 |
662 | } | - |
663 | | - |
664 | if (QWidgetPrivate::get(widget)->renderToTexture) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
665 | if (!widget->d_func()->inDirtyList)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
666 | addDirtyRenderToTextureWidget(widget); never executed: addDirtyRenderToTextureWidget(widget); | 0 |
667 | if (!updateRequestSent || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
668 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
669 | return; never executed: return; | 0 |
670 | } | - |
671 | | - |
672 | | - |
673 | const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); | - |
674 | QRect translatedRect = widgetRect; | - |
675 | if (widget != tlw)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
676 | translatedRect.translate(widget->mapTo(tlw, QPoint())); never executed: translatedRect.translate(widget->mapTo(tlw, QPoint())); | 0 |
677 | | - |
678 | translatedRect = translatedRect.intersected(QRect(QPoint(), tlw->size())); | - |
679 | if (qt_region_strictContains(dirty, translatedRect)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
680 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
681 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
682 | return; never executed: return; | 0 |
683 | } | - |
684 | | - |
685 | if (bufferState == BufferInvalid) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
686 | const bool eventAlreadyPosted = !dirty.isEmpty(); | - |
687 | dirty += translatedRect; | - |
688 | if (!eventAlreadyPosted || updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
689 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
690 | return; never executed: return; | 0 |
691 | } | - |
692 | | - |
693 | if (dirtyWidgets.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
694 | addDirtyWidget(widget, rect); | - |
695 | sendUpdateRequest(tlw, updateTime); | - |
696 | return; never executed: return; | 0 |
697 | } | - |
698 | | - |
699 | if (widget->d_func()->inDirtyList) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
700 | if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
701 | widget->d_func()->dirty += widgetRect; never executed: widget->d_func()->dirty += widgetRect; | 0 |
702 | } else { never executed: end of block | 0 |
703 | addDirtyWidget(widget, rect); | - |
704 | } never executed: end of block | 0 |
705 | | - |
706 | if (updateTime == UpdateNow)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
707 | sendUpdateRequest(tlw, updateTime); never executed: sendUpdateRequest(tlw, updateTime); | 0 |
708 | } never executed: end of block | 0 |
709 | | - |
710 | | - |
711 | | - |
712 | | - |
713 | | - |
714 | | - |
715 | | - |
716 | void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widget, const QPoint &topLevelOffset) | - |
717 | { | - |
718 | if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
719 | return; never executed: return; | 0 |
720 | | - |
721 | #if defined(Q_DEAD_CODE_FROM_QT4_MAC) | - |
722 | if (!widget->testAttribute(Qt::WA_WState_InPaintEvent)) | - |
723 | dirtyOnScreen += region.translated(topLevelOffset); | - |
724 | return; | - |
725 | #endif | - |
726 | | - |
727 | | - |
728 | if (widget == tlw) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
729 | if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
730 | dirtyOnScreen += region; never executed: dirtyOnScreen += region; | 0 |
731 | return; never executed: return; | 0 |
732 | } | - |
733 | | - |
734 | | - |
735 | if (!widget->internalWinId() && !widget->isWindow()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
736 | QWidget *nativeParent = widget->nativeParentWidget(); | - |
737 | if (nativeParent == tlw) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
738 | if (!widget->testAttribute(Qt::WA_WState_InPaintEvent))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
739 | dirtyOnScreen += region.translated(topLevelOffset); never executed: dirtyOnScreen += region.translated(topLevelOffset); | 0 |
740 | return; never executed: return; | 0 |
741 | } | - |
742 | | - |
743 | | - |
744 | QWidgetPrivate *nativeParentPrivate = nativeParent->d_func(); | - |
745 | if (!nativeParentPrivate->needsFlush)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
746 | nativeParentPrivate->needsFlush = new QRegion; never executed: nativeParentPrivate->needsFlush = new QRegion; | 0 |
747 | const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint()); | - |
748 | *nativeParentPrivate->needsFlush += region.translated(nativeParentOffset); | - |
749 | appendDirtyOnScreenWidget(nativeParent); | - |
750 | return; never executed: return; | 0 |
751 | } | - |
752 | | - |
753 | | - |
754 | QWidgetPrivate *widgetPrivate = widget->d_func(); | - |
755 | if (!widgetPrivate->needsFlush)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
756 | widgetPrivate->needsFlush = new QRegion; never executed: widgetPrivate->needsFlush = new QRegion; | 0 |
757 | *widgetPrivate->needsFlush += region; | - |
758 | appendDirtyOnScreenWidget(widget); | - |
759 | } never executed: end of block | 0 |
760 | | - |
761 | void QWidgetBackingStore::removeDirtyWidget(QWidget *w) | - |
762 | { | - |
763 | if (!w)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
764 | return; never executed: return; | 0 |
765 | | - |
766 | dirtyWidgetsRemoveAll(w); | - |
767 | dirtyOnScreenWidgetsRemoveAll(w); | - |
768 | dirtyRenderToTextureWidgets.removeAll(w); | - |
769 | resetWidget(w); | - |
770 | | - |
771 | QWidgetPrivate *wd = w->d_func(); | - |
772 | const int n = wd->children.count(); | - |
773 | for (int i = 0; i < n; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
774 | if (QWidget *child = qobject_cast<QWidget*>(wd->children.at(i)))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
775 | removeDirtyWidget(child); never executed: removeDirtyWidget(child); | 0 |
776 | } never executed: end of block | 0 |
777 | } never executed: end of block | 0 |
778 | | - |
779 | void QWidgetBackingStore::updateLists(QWidget *cur) | - |
780 | { | - |
781 | if (!cur)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
782 | return; never executed: return; | 0 |
783 | | - |
784 | QList<QObject*> children = cur->children(); | - |
785 | for (int i = 0; i < children.size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
786 | QWidget *child = qobject_cast<QWidget*>(children.at(i)); | - |
787 | if (!child)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
788 | continue; never executed: continue; | 0 |
789 | | - |
790 | updateLists(child); | - |
791 | } never executed: end of block | 0 |
792 | | - |
793 | if (cur->testAttribute(Qt::WA_StaticContents))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
794 | addStaticWidget(cur); never executed: addStaticWidget(cur); | 0 |
795 | } never executed: end of block | 0 |
796 | | - |
797 | QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) | - |
798 | : tlw(topLevel), | - |
799 | dirtyOnScreenWidgets(0), | - |
800 | fullUpdatePending(0), | - |
801 | updateRequestSent(0), | - |
802 | textureListWatcher(0), | - |
803 | perfFrames(0) | - |
804 | { | - |
805 | store = tlw->backingStore(); | - |
806 | Q_ASSERT(store); | - |
807 | | - |
808 | | - |
809 | updateLists(topLevel); | - |
810 | } never executed: end of block | 0 |
811 | | - |
812 | QWidgetBackingStore::~QWidgetBackingStore() | - |
813 | { | - |
814 | for (int c = 0; c < dirtyWidgets.size(); ++c)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
815 | resetWidget(dirtyWidgets.at(c)); never executed: resetWidget(dirtyWidgets.at(c)); | 0 |
816 | for (int c = 0; c < dirtyRenderToTextureWidgets.size(); ++c)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
817 | resetWidget(dirtyRenderToTextureWidgets.at(c)); never executed: resetWidget(dirtyRenderToTextureWidgets.at(c)); | 0 |
818 | | - |
819 | delete dirtyOnScreenWidgets; | - |
820 | } never executed: end of block | 0 |
821 | | - |
822 | | - |
823 | | - |
824 | void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) | - |
825 | { | - |
826 | Q_Q(QWidget); | - |
827 | if (!q->isVisible() || (dx == 0 && dy == 0))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
828 | return; never executed: return; | 0 |
829 | | - |
830 | QWidget *tlw = q->window(); | - |
831 | QTLWExtra* x = tlw->d_func()->topData(); | - |
832 | if (x->inTopLevelResize)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
833 | return; never executed: return; | 0 |
834 | | - |
835 | static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_MOVE") == 0; | - |
836 | | - |
837 | QWidget *pw = q->parentWidget(); | - |
838 | QPoint toplevelOffset = pw->mapTo(tlw, QPoint()); | - |
839 | QWidgetPrivate *pd = pw->d_func(); | - |
840 | QRect clipR(pd->clipRect()); | - |
841 | const QRect newRect(rect.translated(dx, dy)); | - |
842 | QRect destRect = rect.intersected(clipR); | - |
843 | if (destRect.isValid())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
844 | destRect = destRect.translated(dx, dy).intersected(clipR); never executed: destRect = destRect.translated(dx, dy).intersected(clipR); | 0 |
845 | const QRect sourceRect(destRect.translated(-dx, -dy)); | - |
846 | const QRect parentRect(rect & clipR); | - |
847 | const bool nativeWithTextureChild = textureChildSeen && q->internalWinId();TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
848 | | - |
849 | bool accelerateMove = accelEnv && isOpaque && !nativeWithTextureChildTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
850 | #ifndef QT_NO_GRAPHICSVIEW | - |
851 | | - |
852 | && !tlw->d_func()->extra->proxyWidgetTRUE | never evaluated | FALSE | never evaluated |
| 0 |
853 | #endif | - |
854 | && !isOverlapped(sourceRect) && !isOverlapped(destRect);TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
855 | | - |
856 | if (!accelerateMove) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
857 | QRegion parentR(effectiveRectFor(parentRect)); | - |
858 | if (!extra || !extra->hasMask) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
859 | parentR -= newRect; | - |
860 | } else { never executed: end of block | 0 |
861 | | - |
862 | parentR += newRect & clipR; | - |
863 | } never executed: end of block | 0 |
864 | pd->invalidateBuffer(parentR); | - |
865 | invalidateBuffer((newRect & clipR).translated(-data.crect.topLeft())); | - |
866 | } else { never executed: end of block | 0 |
867 | | - |
868 | QWidgetBackingStore *wbs = x->backingStoreTracker.data(); | - |
869 | QRegion childExpose(newRect & clipR); | - |
870 | | - |
871 | if (sourceRect.isValid() && wbs->bltRect(sourceRect, dx, dy, pw))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
872 | childExpose -= destRect; never executed: childExpose -= destRect; | 0 |
873 | | - |
874 | if (!pw->updatesEnabled())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
875 | return; never executed: return; | 0 |
876 | | - |
877 | const bool childUpdatesEnabled = q->updatesEnabled(); | - |
878 | if (childUpdatesEnabled && !childExpose.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
879 | childExpose.translate(-data.crect.topLeft()); | - |
880 | wbs->markDirty(childExpose, q); | - |
881 | isMoved = true; | - |
882 | } never executed: end of block | 0 |
883 | | - |
884 | QRegion parentExpose(parentRect); | - |
885 | parentExpose -= newRect; | - |
886 | if (extra && extra->hasMask)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
887 | parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft()); never executed: parentExpose += QRegion(newRect) - extra->mask.translated(data.crect.topLeft()); | 0 |
888 | | - |
889 | if (!parentExpose.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
890 | wbs->markDirty(parentExpose, pw); | - |
891 | pd->isMoved = true; | - |
892 | } never executed: end of block | 0 |
893 | | - |
894 | if (childUpdatesEnabled) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
895 | QRegion needsFlush(sourceRect); | - |
896 | needsFlush += destRect; | - |
897 | wbs->markDirtyOnScreen(needsFlush, pw, toplevelOffset); | - |
898 | } never executed: end of block | 0 |
899 | } never executed: end of block | 0 |
900 | } | - |
901 | | - |
902 | | - |
903 | void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) | - |
904 | { | - |
905 | Q_Q(QWidget); | - |
906 | QWidget *tlw = q->window(); | - |
907 | QTLWExtra* x = tlw->d_func()->topData(); | - |
908 | if (x->inTopLevelResize)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
909 | return; never executed: return; | 0 |
910 | | - |
911 | QWidgetBackingStore *wbs = x->backingStoreTracker.data(); | - |
912 | if (!wbs)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
913 | return; never executed: return; | 0 |
914 | | - |
915 | static const bool accelEnv = qEnvironmentVariableIntValue("QT_NO_FAST_SCROLL") == 0; | - |
916 | | - |
917 | QRect scrollRect = rect & clipRect(); | - |
918 | bool overlapped = false; | - |
919 | bool accelerateScroll = accelEnv && isOpaque && !q_func()->testAttribute(Qt::WA_WState_InPaintEvent)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
920 | && !(overlapped = isOverlapped(scrollRect.translated(data.crect.topLeft())));TRUE | never evaluated | FALSE | never evaluated |
| 0 |
921 | | - |
922 | if (!accelerateScroll) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
923 | if (overlapped) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
924 | QRegion region(scrollRect); | - |
925 | subtractOpaqueSiblings(region); | - |
926 | invalidateBuffer(region); | - |
927 | }else { never executed: end of block | 0 |
928 | invalidateBuffer(scrollRect); | - |
929 | } never executed: end of block | 0 |
930 | } else { | - |
931 | const QPoint toplevelOffset = q->mapTo(tlw, QPoint()); | - |
932 | const QRect destRect = scrollRect.translated(dx, dy) & scrollRect; | - |
933 | const QRect sourceRect = destRect.translated(-dx, -dy); | - |
934 | | - |
935 | QRegion childExpose(scrollRect); | - |
936 | if (sourceRect.isValid()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
937 | if (wbs->bltRect(sourceRect, dx, dy, q))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
938 | childExpose -= destRect; never executed: childExpose -= destRect; | 0 |
939 | } never executed: end of block | 0 |
940 | | - |
941 | if (inDirtyList) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
942 | if (rect == q->rect()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
943 | dirty.translate(dx, dy); | - |
944 | } else { never executed: end of block | 0 |
945 | QRegion dirtyScrollRegion = dirty.intersected(scrollRect); | - |
946 | if (!dirtyScrollRegion.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
947 | dirty -= dirtyScrollRegion; | - |
948 | dirtyScrollRegion.translate(dx, dy); | - |
949 | dirty += dirtyScrollRegion; | - |
950 | } never executed: end of block | 0 |
951 | } never executed: end of block | 0 |
952 | } | - |
953 | | - |
954 | if (!q->updatesEnabled())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
955 | return; never executed: return; | 0 |
956 | | - |
957 | if (!childExpose.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
958 | wbs->markDirty(childExpose, q); | - |
959 | isScrolled = true; | - |
960 | } never executed: end of block | 0 |
961 | | - |
962 | | - |
963 | | - |
964 | | - |
965 | wbs->markDirtyOnScreen(destRect, q, toplevelOffset); | - |
966 | } never executed: end of block | 0 |
967 | } | - |
968 | | - |
969 | #ifndef QT_NO_OPENGL | - |
970 | static void findTextureWidgetsRecursively(QWidget *tlw, QWidget *widget, QPlatformTextureList *widgetTextures, QVector<QWidget *> *nativeChildren) | - |
971 | { | - |
972 | QWidgetPrivate *wd = QWidgetPrivate::get(widget); | - |
973 | if (wd->renderToTexture) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
974 | QPlatformTextureList::Flags flags = 0; | - |
975 | if (widget->testAttribute(Qt::WA_AlwaysStackOnTop))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
976 | flags |= QPlatformTextureList::StacksOnTop; never executed: flags |= QPlatformTextureList::StacksOnTop; | 0 |
977 | const QRect rect(widget->mapTo(tlw, QPoint()), widget->size()); | - |
978 | widgetTextures->appendTexture(widget, wd->textureId(), rect, wd->clipRect(), flags); | - |
979 | } never executed: end of block | 0 |
980 | | - |
981 | for (int i = 0; i < wd->children.size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
982 | QWidget *w = qobject_cast<QWidget *>(wd->children.at(i)); | - |
983 | | - |
984 | if (w && !w->isWindow() && w->internalWinId())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
985 | nativeChildren->append(w); never executed: nativeChildren->append(w); | 0 |
986 | if (w && !w->isWindow() && !w->internalWinId() && !w->isHidden() && QWidgetPrivate::get(w)->textureChildSeen)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
987 | findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren); never executed: findTextureWidgetsRecursively(tlw, w, widgetTextures, nativeChildren); | 0 |
988 | } never executed: end of block | 0 |
989 | } never executed: end of block | 0 |
990 | | - |
991 | static void findAllTextureWidgetsRecursively(QWidget *tlw, QWidget *widget) | - |
992 | { | - |
993 | | - |
994 | if (QWidgetPrivate::get(widget)->textureChildSeen) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
995 | QVector<QWidget *> nativeChildren; | - |
996 | QScopedPointer<QPlatformTextureList> tl(new QPlatformTextureList); | - |
997 | | - |
998 | | - |
999 | findTextureWidgetsRecursively(tlw, widget, tl.data(), &nativeChildren); | - |
1000 | | - |
1001 | if (!tl->isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1002 | QWidgetPrivate::get(tlw)->topData()->widgetTextures.append(tl.take()); never executed: QWidgetPrivate::get(tlw)->topData()->widgetTextures.append(tl.take()); | 0 |
1003 | | - |
1004 | foreach (QWidget *ncw, nativeChildren) { | - |
1005 | if (QWidgetPrivate::get(ncw)->textureChildSeen)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1006 | findAllTextureWidgetsRecursively(tlw, ncw); never executed: findAllTextureWidgetsRecursively(tlw, ncw); | 0 |
1007 | } never executed: end of block | 0 |
1008 | } never executed: end of block | 0 |
1009 | } never executed: end of block | 0 |
1010 | | - |
1011 | static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) | - |
1012 | { | - |
1013 | foreach (QPlatformTextureList *tl, QWidgetPrivate::get(tlw)->topData()->widgetTextures) { | - |
1014 | Q_ASSERT(!tl->isEmpty()); | - |
1015 | for (int i = 0; i < tl->count(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1016 | QWidget *w = static_cast<QWidget *>(tl->source(i)); | - |
1017 | if ((w->internalWinId() && w == widget) || (!w->internalWinId() && w->nativeParentWidget() == widget))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1018 | return tl; never executed: return tl; | 0 |
1019 | } never executed: end of block | 0 |
1020 | } never executed: end of block | 0 |
1021 | | - |
1022 | if (QWidgetPrivate::get(tlw)->textureChildSeen) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1023 | | - |
1024 | | - |
1025 | | - |
1026 | | - |
1027 | | - |
1028 | static bool switchableWidgetComposition = | - |
1029 | QGuiApplicationPrivate::instance()->platformIntegration() | - |
1030 | ->hasCapability(QPlatformIntegration::SwitchableWidgetComposition); | - |
1031 | if (!switchableWidgetCompositionTRUE | never evaluated | FALSE | never evaluated |
| 0 |
1032 | | - |
1033 | | - |
1034 | | - |
1035 | | - |
1036 | | - |
1037 | #if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) && !defined(Q_OS_WINCE) | - |
1038 | || tlw->windowState().testFlag(Qt::WindowFullScreen) | - |
1039 | || tlw->testAttribute(Qt::WA_TranslucentBackground) | - |
1040 | #endif | - |
1041 | ) | - |
1042 | { | - |
1043 | return qt_dummy_platformTextureList(); never executed: return qt_dummy_platformTextureList(); | 0 |
1044 | } | - |
1045 | } never executed: end of block | 0 |
1046 | | - |
1047 | return 0; never executed: return 0; | 0 |
1048 | } | - |
1049 | | - |
1050 | | - |
1051 | | - |
1052 | | - |
1053 | | - |
1054 | | - |
1055 | QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetBackingStore *backingStore) | - |
1056 | : m_backingStore(backingStore) | - |
1057 | { | - |
1058 | } never executed: end of block | 0 |
1059 | | - |
1060 | void QPlatformTextureListWatcher::watch(QPlatformTextureList *textureList) | - |
1061 | { | - |
1062 | connect(textureList, SIGNAL(locked(bool)), SLOT(onLockStatusChanged(bool))); | - |
1063 | m_locked[textureList] = textureList->isLocked(); | - |
1064 | } never executed: end of block | 0 |
1065 | | - |
1066 | bool QPlatformTextureListWatcher::isLocked() const | - |
1067 | { | - |
1068 | foreach (bool v, m_locked) { | - |
1069 | if (v)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1070 | return true; never executed: return true; | 0 |
1071 | } never executed: end of block | 0 |
1072 | return false; never executed: return false; | 0 |
1073 | } | - |
1074 | | - |
1075 | void QPlatformTextureListWatcher::onLockStatusChanged(bool locked) | - |
1076 | { | - |
1077 | QPlatformTextureList *tl = static_cast<QPlatformTextureList *>(sender()); | - |
1078 | m_locked[tl] = locked; | - |
1079 | if (!isLocked())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1080 | m_backingStore->sync(); never executed: m_backingStore->sync(); | 0 |
1081 | } never executed: end of block | 0 |
1082 | | - |
1083 | #else | - |
1084 | | - |
1085 | static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) | - |
1086 | { | - |
1087 | Q_UNUSED(tlw); | - |
1088 | Q_UNUSED(widget); | - |
1089 | return Q_NULLPTR; | - |
1090 | } | - |
1091 | | - |
1092 | #endif // QT_NO_OPENGL | - |
1093 | | - |
1094 | static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) | - |
1095 | { | - |
1096 | if (!tlw || !tlwExtra || !tlw->testAttribute(Qt::WA_Mapped) || !tlw->isVisible())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1097 | return true; never executed: return true; | 0 |
1098 | | - |
1099 | return false; never executed: return false; | 0 |
1100 | } | - |
1101 | | - |
1102 | bool QWidgetBackingStore::syncAllowed() | - |
1103 | { | - |
1104 | #ifndef QT_NO_OPENGL | - |
1105 | QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); | - |
1106 | if (textureListWatcher && !textureListWatcher->isLocked()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1107 | textureListWatcher->deleteLater(); | - |
1108 | textureListWatcher = 0; | - |
1109 | } else if (!tlwExtra->widgetTextures.isEmpty()) { never executed: end of block TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1110 | bool skipSync = false; | - |
1111 | foreach (QPlatformTextureList *tl, tlwExtra->widgetTextures) { | - |
1112 | if (tl->isLocked()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1113 | if (!textureListWatcher)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1114 | textureListWatcher = new QPlatformTextureListWatcher(this); never executed: textureListWatcher = new QPlatformTextureListWatcher(this); | 0 |
1115 | if (!textureListWatcher->isLocked())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1116 | textureListWatcher->watch(tl); never executed: textureListWatcher->watch(tl); | 0 |
1117 | skipSync = true; | - |
1118 | } never executed: end of block | 0 |
1119 | } never executed: end of block | 0 |
1120 | if (skipSync) TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1121 | return false; never executed: return false; | 0 |
1122 | } never executed: end of block | 0 |
1123 | #endif | - |
1124 | return true; never executed: return true; | 0 |
1125 | } | - |
1126 | | - |
1127 | | - |
1128 | | - |
1129 | | - |
1130 | | - |
1131 | | - |
1132 | | - |
1133 | | - |
1134 | void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedRegion) | - |
1135 | { | - |
1136 | QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); | - |
1137 | if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1138 | return; never executed: return; | 0 |
1139 | | - |
1140 | if (!exposedWidget || !exposedWidget->internalWinId() || !exposedWidget->isVisible() || !exposedWidget->testAttribute(Qt::WA_Mapped)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1141 | || !exposedWidget->updatesEnabled() || exposedRegion.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1142 | return; never executed: return; | 0 |
1143 | } | - |
1144 | | - |
1145 | | - |
1146 | if (!isDirty() && store->size().isValid()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1147 | QPlatformTextureList *tl = widgetTexturesFor(tlw, exposedWidget); | - |
1148 | qt_flush(exposedWidget, tl ? QRegion() : exposedRegion, store, tlw, tlwOffset, tl, this); | - |
1149 | return; never executed: return; | 0 |
1150 | } | - |
1151 | | - |
1152 | if (exposedWidget != tlw)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1153 | markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint())); never executed: markDirtyOnScreen(exposedRegion, exposedWidget, exposedWidget->mapTo(tlw, QPoint())); | 0 |
1154 | else | - |
1155 | markDirtyOnScreen(exposedRegion, exposedWidget, QPoint()); never executed: markDirtyOnScreen(exposedRegion, exposedWidget, QPoint()); | 0 |
1156 | | - |
1157 | if (syncAllowed())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1158 | doSync(); never executed: doSync(); | 0 |
1159 | } never executed: end of block | 0 |
1160 | | - |
1161 | | - |
1162 | | - |
1163 | | - |
1164 | void QWidgetBackingStore::sync() | - |
1165 | { | - |
1166 | updateRequestSent = false; | - |
1167 | QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); | - |
1168 | if (discardSyncRequest(tlw, tlwExtra)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1169 | | - |
1170 | | - |
1171 | | - |
1172 | | - |
1173 | | - |
1174 | if (!tlw->isVisible()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1175 | dirty = QRegion(); | - |
1176 | for (int i = 0; i < dirtyWidgets.size(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1177 | resetWidget(dirtyWidgets.at(i)); never executed: resetWidget(dirtyWidgets.at(i)); | 0 |
1178 | dirtyWidgets.clear(); | - |
1179 | fullUpdatePending = false; | - |
1180 | } never executed: end of block | 0 |
1181 | return; never executed: return; | 0 |
1182 | } | - |
1183 | | - |
1184 | if (syncAllowed())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1185 | doSync(); never executed: doSync(); | 0 |
1186 | } never executed: end of block | 0 |
1187 | | - |
1188 | void QWidgetBackingStore::doSync() | - |
1189 | { | - |
1190 | const bool updatesDisabled = !tlw->updatesEnabled(); | - |
1191 | bool repaintAllWidgets = false; | - |
1192 | | - |
1193 | const bool inTopLevelResize = tlw->d_func()->maybeTopData()->inTopLevelResize; | - |
1194 | const QRect tlwRect(topLevelRect()); | - |
1195 | const QRect surfaceGeometry(tlwRect.topLeft(), store->size()); | - |
1196 | if ((fullUpdatePending || inTopLevelResize || surfaceGeometry.size() != tlwRect.size()) && !updatesDisabled) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1197 | if (hasStaticContents() && !store->size().isEmpty() ) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1198 | | - |
1199 | const QRect clipRect(0, 0, surfaceGeometry.width(), surfaceGeometry.height()); | - |
1200 | const QRegion staticRegion(staticContents(0, clipRect)); | - |
1201 | QRegion newVisible(0, 0, tlwRect.width(), tlwRect.height()); | - |
1202 | newVisible -= staticRegion; | - |
1203 | dirty += newVisible; | - |
1204 | store->setStaticContents(staticRegion); | - |
1205 | } else { never executed: end of block | 0 |
1206 | | - |
1207 | dirty = QRegion(0, 0, tlwRect.width(), tlwRect.height()); | - |
1208 | for (int i = 0; i < dirtyWidgets.size(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1209 | resetWidget(dirtyWidgets.at(i)); never executed: resetWidget(dirtyWidgets.at(i)); | 0 |
1210 | dirtyWidgets.clear(); | - |
1211 | repaintAllWidgets = true; | - |
1212 | } never executed: end of block | 0 |
1213 | } | - |
1214 | | - |
1215 | if (inTopLevelResize || surfaceGeometry.size() != tlwRect.size())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1216 | store->resize(tlwRect.size()); never executed: store->resize(tlwRect.size()); | 0 |
1217 | | - |
1218 | if (updatesDisabled)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1219 | return; never executed: return; | 0 |
1220 | | - |
1221 | | - |
1222 | QRegion toClean(dirty); | - |
1223 | | - |
1224 | | - |
1225 | | - |
1226 | | - |
1227 | | - |
1228 | QVarLengthArray<QWidget *, 32> opaqueNonOverlappedWidgets; | - |
1229 | for (int i = 0; i < dirtyWidgets.size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1230 | QWidget *w = dirtyWidgets.at(i); | - |
1231 | QWidgetPrivate *wd = w->d_func(); | - |
1232 | if (wd->data.in_destructor)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1233 | continue; never executed: continue; | 0 |
1234 | | - |
1235 | | - |
1236 | wd->dirty &= wd->clipRect(); | - |
1237 | wd->clipToEffectiveMask(wd->dirty); | - |
1238 | | - |
1239 | | - |
1240 | bool hasDirtySiblingsAbove = false; | - |
1241 | | - |
1242 | if (!wd->isMoved)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1243 | wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove); never executed: wd->subtractOpaqueSiblings(wd->dirty, &hasDirtySiblingsAbove); | 0 |
1244 | | - |
1245 | | - |
1246 | | - |
1247 | | - |
1248 | | - |
1249 | const QRegion dirtyBeforeSubtractedOpaqueChildren = wd->dirty; | - |
1250 | | - |
1251 | | - |
1252 | if (!wd->isScrolled && !wd->isMoved)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1253 | wd->subtractOpaqueChildren(wd->dirty, w->rect()); never executed: wd->subtractOpaqueChildren(wd->dirty, w->rect()); | 0 |
1254 | | - |
1255 | if (wd->dirty.isEmpty() && wd->textureChildSeen)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1256 | wd->dirty = dirtyBeforeSubtractedOpaqueChildren; never executed: wd->dirty = dirtyBeforeSubtractedOpaqueChildren; | 0 |
1257 | | - |
1258 | if (wd->dirty.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1259 | resetWidget(w); | - |
1260 | continue; never executed: continue; | 0 |
1261 | } | - |
1262 | | - |
1263 | const QRegion widgetDirty(w != tlw ? wd->dirty.translated(w->mapTo(tlw, QPoint())) | - |
1264 | : wd->dirty); | - |
1265 | toClean += widgetDirty; | - |
1266 | | - |
1267 | #ifndef QT_NO_GRAPHICSVIEW | - |
1268 | if (tlw->d_func()->extra->proxyWidget) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1269 | resetWidget(w); | - |
1270 | continue; never executed: continue; | 0 |
1271 | } | - |
1272 | #endif | - |
1273 | | - |
1274 | if (!hasDirtySiblingsAbove && wd->isOpaque && !dirty.intersects(widgetDirty.boundingRect())) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1275 | opaqueNonOverlappedWidgets.append(w); | - |
1276 | } else { never executed: end of block | 0 |
1277 | resetWidget(w); | - |
1278 | dirty += widgetDirty; | - |
1279 | } never executed: end of block | 0 |
1280 | } | - |
1281 | dirtyWidgets.clear(); | - |
1282 | | - |
1283 | #ifndef QT_NO_OPENGL | - |
1284 | | - |
1285 | | - |
1286 | | - |
1287 | QTLWExtra *tlwExtra = tlw->d_func()->topData(); | - |
1288 | qDeleteAll(tlwExtra->widgetTextures); | - |
1289 | tlwExtra->widgetTextures.clear(); | - |
1290 | findAllTextureWidgetsRecursively(tlw, tlw); | - |
1291 | qt_window_private(tlw->windowHandle())->compositing = false; | - |
1292 | fullUpdatePending = false; | - |
1293 | #endif | - |
1294 | | - |
1295 | if (toClean.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1296 | | - |
1297 | | - |
1298 | | - |
1299 | | - |
1300 | | - |
1301 | QVarLengthArray<QWidget *, 16> paintPending; | - |
1302 | const int numPaintPending = dirtyRenderToTextureWidgets.count(); | - |
1303 | paintPending.reserve(numPaintPending); | - |
1304 | for (int i = 0; i < numPaintPending; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1305 | QWidget *w = dirtyRenderToTextureWidgets.at(i); | - |
1306 | paintPending << w; | - |
1307 | resetWidget(w); | - |
1308 | } never executed: end of block | 0 |
1309 | dirtyRenderToTextureWidgets.clear(); | - |
1310 | for (int i = 0; i < numPaintPending; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1311 | QWidget *w = paintPending[i]; | - |
1312 | w->d_func()->sendPaintEvent(w->rect()); | - |
1313 | if (w != tlw) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1314 | QWidget *npw = w->nativeParentWidget(); | - |
1315 | if (w->internalWinId() || (npw && npw != tlw)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1316 | if (!w->internalWinId())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1317 | w = npw; never executed: w = npw; | 0 |
1318 | QWidgetPrivate *wPrivate = w->d_func(); | - |
1319 | if (!wPrivate->needsFlush)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1320 | wPrivate->needsFlush = new QRegion; never executed: wPrivate->needsFlush = new QRegion; | 0 |
1321 | appendDirtyOnScreenWidget(w); | - |
1322 | } never executed: end of block | 0 |
1323 | } never executed: end of block | 0 |
1324 | } never executed: end of block | 0 |
1325 | | - |
1326 | | - |
1327 | | - |
1328 | | - |
1329 | flush(); | - |
1330 | | - |
1331 | return; never executed: return; | 0 |
1332 | } | - |
1333 | | - |
1334 | #ifndef QT_NO_OPENGL | - |
1335 | foreach (QPlatformTextureList *tl, tlwExtra->widgetTextures) { | - |
1336 | for (int i = 0; i < tl->count(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1337 | QWidget *w = static_cast<QWidget *>(tl->source(i)); | - |
1338 | if (dirtyRenderToTextureWidgets.contains(w)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1339 | const QRect rect = tl->geometry(i); | - |
1340 | | - |
1341 | | - |
1342 | w->d_func()->renderToTextureReallyDirty = 1; | - |
1343 | dirty += rect; | - |
1344 | toClean += rect; | - |
1345 | } never executed: end of block | 0 |
1346 | } never executed: end of block | 0 |
1347 | } never executed: end of block | 0 |
1348 | for (int i = 0; i < dirtyRenderToTextureWidgets.count(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1349 | resetWidget(dirtyRenderToTextureWidgets.at(i)); never executed: resetWidget(dirtyRenderToTextureWidgets.at(i)); | 0 |
1350 | dirtyRenderToTextureWidgets.clear(); | - |
1351 | #endif | - |
1352 | | - |
1353 | #ifndef QT_NO_GRAPHICSVIEW | - |
1354 | if (tlw->d_func()->extra->proxyWidget) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1355 | updateStaticContentsSize(); | - |
1356 | dirty = QRegion(); | - |
1357 | updateRequestSent = false; | - |
1358 | const QVector<QRect> rects(toClean.rects()); | - |
1359 | for (int i = 0; i < rects.size(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1360 | tlw->d_func()->extra->proxyWidget->update(rects.at(i)); never executed: tlw->d_func()->extra->proxyWidget->update(rects.at(i)); | 0 |
1361 | return; never executed: return; | 0 |
1362 | } | - |
1363 | #endif | - |
1364 | | - |
1365 | BeginPaintInfo beginPaintInfo; | - |
1366 | beginPaint(toClean, tlw, store, &beginPaintInfo); | - |
1367 | if (beginPaintInfo.nothingToPaint) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1368 | for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1369 | resetWidget(opaqueNonOverlappedWidgets[i]); never executed: resetWidget(opaqueNonOverlappedWidgets[i]); | 0 |
1370 | dirty = QRegion(); | - |
1371 | updateRequestSent = false; | - |
1372 | return; never executed: return; | 0 |
1373 | } | - |
1374 | | - |
1375 | | - |
1376 | | - |
1377 | updateStaticContentsSize(); | - |
1378 | const QRegion dirtyCopy(dirty); | - |
1379 | dirty = QRegion(); | - |
1380 | updateRequestSent = false; | - |
1381 | | - |
1382 | | - |
1383 | for (int i = 0; i < opaqueNonOverlappedWidgets.size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1384 | QWidget *w = opaqueNonOverlappedWidgets[i]; | - |
1385 | QWidgetPrivate *wd = w->d_func(); | - |
1386 | | - |
1387 | int flags = QWidgetPrivate::DrawRecursive; | - |
1388 | | - |
1389 | if (!wd->isScrolled && !wd->isMoved)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1390 | flags |= QWidgetPrivate::DontDrawOpaqueChildren; never executed: flags |= QWidgetPrivate::DontDrawOpaqueChildren; | 0 |
1391 | if (w == tlw)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1392 | flags |= QWidgetPrivate::DrawAsRoot; never executed: flags |= QWidgetPrivate::DrawAsRoot; | 0 |
1393 | | - |
1394 | QRegion toBePainted(wd->dirty); | - |
1395 | resetWidget(w); | - |
1396 | | - |
1397 | QPoint offset(tlwOffset); | - |
1398 | if (w != tlw)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1399 | offset += w->mapTo(tlw, QPoint()); never executed: offset += w->mapTo(tlw, QPoint()); | 0 |
1400 | wd->drawWidget(store->paintDevice(), toBePainted, offset, flags, 0, this); | - |
1401 | } never executed: end of block | 0 |
1402 | | - |
1403 | | - |
1404 | if (repaintAllWidgets || !dirtyCopy.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1405 | const int flags = QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawRecursive; | - |
1406 | tlw->d_func()->drawWidget(store->paintDevice(), dirtyCopy, tlwOffset, flags, 0, this); | - |
1407 | } never executed: end of block | 0 |
1408 | | - |
1409 | endPaint(toClean, store, &beginPaintInfo); | - |
1410 | } never executed: end of block | 0 |
1411 | | - |
1412 | | - |
1413 | | - |
1414 | | - |
1415 | | - |
1416 | | - |
1417 | void QWidgetBackingStore::flush(QWidget *widget) | - |
1418 | { | - |
1419 | const bool hasDirtyOnScreenWidgets = dirtyOnScreenWidgets && !dirtyOnScreenWidgets->isEmpty();TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1420 | bool flushed = false; | - |
1421 | | - |
1422 | | - |
1423 | if (!dirtyOnScreen.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1424 | QWidget *target = widget ? widget : tlw;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1425 | qt_flush(target, dirtyOnScreen, store, tlw, tlwOffset, widgetTexturesFor(tlw, tlw), this); | - |
1426 | dirtyOnScreen = QRegion(); | - |
1427 | flushed = true; | - |
1428 | } never executed: end of block | 0 |
1429 | | - |
1430 | | - |
1431 | if (!flushed && !hasDirtyOnScreenWidgets) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1432 | #ifndef QT_NO_OPENGL | - |
1433 | if (!tlw->d_func()->topData()->widgetTextures.isEmpty()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1434 | QPlatformTextureList *tl = widgetTexturesFor(tlw, tlw); | - |
1435 | if (tl) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1436 | QWidget *target = widget ? widget : tlw;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1437 | qt_flush(target, QRegion(), store, tlw, tlwOffset, tl, this); | - |
1438 | } never executed: end of block | 0 |
1439 | } never executed: end of block | 0 |
1440 | #endif | - |
1441 | } never executed: end of block | 0 |
1442 | | - |
1443 | if (!hasDirtyOnScreenWidgets)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1444 | return; never executed: return; | 0 |
1445 | | - |
1446 | for (int i = 0; i < dirtyOnScreenWidgets->size(); ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1447 | QWidget *w = dirtyOnScreenWidgets->at(i); | - |
1448 | QWidgetPrivate *wd = w->d_func(); | - |
1449 | Q_ASSERT(wd->needsFlush); | - |
1450 | QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0;TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1451 | qt_flush(w, *wd->needsFlush, store, tlw, tlwOffset, widgetTexturesForNative, this); | - |
1452 | *wd->needsFlush = QRegion(); | - |
1453 | } never executed: end of block | 0 |
1454 | dirtyOnScreenWidgets->clear(); | - |
1455 | } never executed: end of block | 0 |
1456 | | - |
1457 | static inline bool discardInvalidateBufferRequest(QWidget *widget, QTLWExtra *tlwExtra) | - |
1458 | { | - |
1459 | Q_ASSERT(widget); | - |
1460 | if (QApplication::closingDown())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1461 | return true; never executed: return true; | 0 |
1462 | | - |
1463 | if (!tlwExtra || tlwExtra->inTopLevelResize || !tlwExtra->backingStore)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1464 | return true; never executed: return true; | 0 |
1465 | | - |
1466 | if (!widget->isVisible() || !widget->updatesEnabled())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1467 | return true; never executed: return true; | 0 |
1468 | | - |
1469 | return false; never executed: return false; | 0 |
1470 | } | - |
1471 | | - |
1472 | | - |
1473 | | - |
1474 | | - |
1475 | | - |
1476 | void QWidgetPrivate::invalidateBuffer_resizeHelper(const QPoint &oldPos, const QSize &oldSize) | - |
1477 | { | - |
1478 | Q_Q(QWidget); | - |
1479 | Q_ASSERT(!q->isWindow()); | - |
1480 | Q_ASSERT(q->parentWidget()); | - |
1481 | | - |
1482 | const bool staticContents = q->testAttribute(Qt::WA_StaticContents); | - |
1483 | const bool sizeDecreased = (data.crect.width() < oldSize.width())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1484 | || (data.crect.height() < oldSize.height());TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1485 | | - |
1486 | const QPoint offset(data.crect.x() - oldPos.x(), data.crect.y() - oldPos.y()); | - |
1487 | const bool parentAreaExposed = !offset.isNull() || sizeDecreased;TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1488 | const QRect newWidgetRect(q->rect()); | - |
1489 | const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height()); | - |
1490 | | - |
1491 | if (!staticContents || graphicsEffect) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1492 | QRegion staticChildren; | - |
1493 | QWidgetBackingStore *bs = 0; | - |
1494 | if (offset.isNull() && (bs = maybeBackingStore()))TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1495 | staticChildren = bs->staticContents(q, oldWidgetRect); never executed: staticChildren = bs->staticContents(q, oldWidgetRect); | 0 |
1496 | const bool hasStaticChildren = !staticChildren.isEmpty(); | - |
1497 | | - |
1498 | if (hasStaticChildren) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1499 | QRegion dirty(newWidgetRect); | - |
1500 | dirty -= staticChildren; | - |
1501 | invalidateBuffer(dirty); | - |
1502 | } else { never executed: end of block | 0 |
1503 | | - |
1504 | invalidateBuffer(newWidgetRect); | - |
1505 | } never executed: end of block | 0 |
1506 | | - |
1507 | if (!parentAreaExposed)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1508 | return; never executed: return; | 0 |
1509 | | - |
1510 | | - |
1511 | if (!graphicsEffect && extra && extra->hasMask) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1512 | QRegion parentExpose(extra->mask.translated(oldPos)); | - |
1513 | parentExpose &= QRect(oldPos, oldSize); | - |
1514 | if (hasStaticChildren)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1515 | parentExpose -= data.crect; never executed: parentExpose -= data.crect; | 0 |
1516 | q->parentWidget()->d_func()->invalidateBuffer(parentExpose); | - |
1517 | } else { never executed: end of block | 0 |
1518 | if (hasStaticChildren && !graphicsEffect) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1519 | QRegion parentExpose(QRect(oldPos, oldSize)); | - |
1520 | parentExpose -= data.crect; | - |
1521 | q->parentWidget()->d_func()->invalidateBuffer(parentExpose); | - |
1522 | } else { never executed: end of block | 0 |
1523 | q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize))); | - |
1524 | } never executed: end of block | 0 |
1525 | } | - |
1526 | return; never executed: return; | 0 |
1527 | } | - |
1528 | | - |
1529 | | - |
1530 | if (!offset.isNull()) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1531 | if (sizeDecreased) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1532 | const QSize minSize(qMin(oldSize.width(), data.crect.width()), | - |
1533 | qMin(oldSize.height(), data.crect.height())); | - |
1534 | moveRect(QRect(oldPos, minSize), offset.x(), offset.y()); | - |
1535 | } else { never executed: end of block | 0 |
1536 | moveRect(QRect(oldPos, oldSize), offset.x(), offset.y()); | - |
1537 | } never executed: end of block | 0 |
1538 | } | - |
1539 | | - |
1540 | | - |
1541 | if (!sizeDecreased || !oldWidgetRect.contains(newWidgetRect)) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1542 | QRegion newVisible(newWidgetRect); | - |
1543 | newVisible -= oldWidgetRect; | - |
1544 | invalidateBuffer(newVisible); | - |
1545 | } never executed: end of block | 0 |
1546 | | - |
1547 | if (!parentAreaExposed)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1548 | return; never executed: return; | 0 |
1549 | | - |
1550 | | - |
1551 | const QRect oldRect(oldPos, oldSize); | - |
1552 | if (extra && extra->hasMask) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1553 | QRegion parentExpose(oldRect); | - |
1554 | parentExpose &= extra->mask.translated(oldPos); | - |
1555 | parentExpose -= (extra->mask.translated(data.crect.topLeft()) & data.crect); | - |
1556 | q->parentWidget()->d_func()->invalidateBuffer(parentExpose); | - |
1557 | } else { never executed: end of block | 0 |
1558 | QRegion parentExpose(oldRect); | - |
1559 | parentExpose -= data.crect; | - |
1560 | q->parentWidget()->d_func()->invalidateBuffer(parentExpose); | - |
1561 | } never executed: end of block | 0 |
1562 | } | - |
1563 | | - |
1564 | | - |
1565 | | - |
1566 | | - |
1567 | | - |
1568 | | - |
1569 | | - |
1570 | | - |
1571 | void QWidgetPrivate::invalidateBuffer(const QRegion &rgn) | - |
1572 | { | - |
1573 | Q_Q(QWidget); | - |
1574 | | - |
1575 | QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); | - |
1576 | if (discardInvalidateBufferRequest(q, tlwExtra) || rgn.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1577 | return; never executed: return; | 0 |
1578 | | - |
1579 | QRegion wrgn(rgn); | - |
1580 | wrgn &= clipRect(); | - |
1581 | if (!graphicsEffect && extra && extra->hasMask)TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1582 | wrgn &= extra->mask; never executed: wrgn &= extra->mask; | 0 |
1583 | if (wrgn.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1584 | return; never executed: return; | 0 |
1585 | | - |
1586 | tlwExtra->backingStoreTracker->markDirty(wrgn, q, | - |
1587 | QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); | - |
1588 | } never executed: end of block | 0 |
1589 | | - |
1590 | | - |
1591 | | - |
1592 | | - |
1593 | | - |
1594 | | - |
1595 | | - |
1596 | | - |
1597 | void QWidgetPrivate::invalidateBuffer(const QRect &rect) | - |
1598 | { | - |
1599 | Q_Q(QWidget); | - |
1600 | | - |
1601 | QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); | - |
1602 | if (discardInvalidateBufferRequest(q, tlwExtra) || rect.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1603 | return; never executed: return; | 0 |
1604 | | - |
1605 | QRect wRect(rect); | - |
1606 | wRect &= clipRect(); | - |
1607 | if (wRect.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1608 | return; never executed: return; | 0 |
1609 | | - |
1610 | if (graphicsEffect || !extra || !extra->hasMask) {TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1611 | tlwExtra->backingStoreTracker->markDirty(wRect, q, | - |
1612 | QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); | - |
1613 | return; never executed: return; | 0 |
1614 | } | - |
1615 | | - |
1616 | QRegion wRgn(extra->mask); | - |
1617 | wRgn &= wRect; | - |
1618 | if (wRgn.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1619 | return; never executed: return; | 0 |
1620 | | - |
1621 | tlwExtra->backingStoreTracker->markDirty(wRgn, q, | - |
1622 | QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); | - |
1623 | } never executed: end of block | 0 |
1624 | | - |
1625 | void QWidgetPrivate::repaint_sys(const QRegion &rgn) | - |
1626 | { | - |
1627 | if (data.in_destructor)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1628 | return; never executed: return; | 0 |
1629 | | - |
1630 | Q_Q(QWidget); | - |
1631 | if (discardSyncRequest(q, maybeTopData()))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1632 | return; never executed: return; | 0 |
1633 | | - |
1634 | if (q->testAttribute(Qt::WA_StaticContents)) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1635 | if (!extra)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1636 | createExtra(); never executed: createExtra(); | 0 |
1637 | extra->staticContentsSize = data.crect.size(); | - |
1638 | } never executed: end of block | 0 |
1639 | | - |
1640 | QPaintEngine *engine = q->paintEngine(); | - |
1641 | | - |
1642 | | - |
1643 | | - |
1644 | | - |
1645 | const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGLTRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1646 | || engine->type() == QPaintEngine::OpenGL2))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1647 | && (usesDoubleBufferedGLContext || q->autoFillBackground());TRUE | never evaluated | FALSE | never evaluated |
TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1648 | QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); | - |
1649 | | - |
1650 | #ifdef Q_DEAD_CODE_FROM_QT4_MAC | - |
1651 | | - |
1652 | update_sys(toBePainted); | - |
1653 | return; | - |
1654 | #endif | - |
1655 | | - |
1656 | toBePainted &= clipRect(); | - |
1657 | clipToEffectiveMask(toBePainted); | - |
1658 | if (toBePainted.isEmpty())TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1659 | return; never executed: return; | 0 |
1660 | | - |
1661 | #ifndef QT_NO_PAINT_DEBUG | - |
1662 | bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); | - |
1663 | #endif | - |
1664 | | - |
1665 | drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0); | - |
1666 | | - |
1667 | #ifndef QT_NO_PAINT_DEBUG | - |
1668 | if (flushed)TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1669 | QWidgetBackingStore::unflushPaint(q, toBePainted); never executed: QWidgetBackingStore::unflushPaint(q, toBePainted); | 0 |
1670 | #endif | - |
1671 | | - |
1672 | if (Q_UNLIKELY(q->paintingActive()))TRUE | never evaluated | FALSE | never evaluated |
| 0 |
1673 | qWarning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent"); never executed: QMessageLogger(__FILE__, 1673, __PRETTY_FUNCTION__).warning("QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent"); | 0 |
1674 | } never executed: end of block | 0 |
1675 | | - |
1676 | | - |
1677 | QT_END_NAMESPACE | - |
1678 | | - |
1679 | #include "moc_qwidgetbackingstore_p.cpp" | - |
| | |