Changeset 561 for trunk/src/gui/painting/qbackingstore.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/painting/qbackingstore.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** 40 40 ****************************************************************************/ 41 42 43 #include "qplatformdefs.h" 41 44 42 45 #include "qbackingstore_p.h" … … 54 57 #include <private/qapplication_p.h> 55 58 #include <private/qpaintengine_raster_p.h> 59 #include <private/qgraphicseffect_p.h> 56 60 57 61 #include "qgraphicssystem_p.h" … … 259 263 { 260 264 const QPoint pos(tlwOffset + widget->mapTo(tlw, rect.topLeft())); 261 return windowSurface->scroll(QRect(pos, rect.size()), dx, dy); 265 const QRect tlwRect(QRect(pos, rect.size())); 266 if (dirty.intersects(tlwRect)) 267 return false; // We don't want to scroll junk. 268 return windowSurface->scroll(tlwRect, dx, dy); 262 269 } 263 270 … … 492 499 return; 493 500 494 #if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)495 if (QApplicationPrivate::inSizeMove && widget->internalWinId() && !updateImmediately) {496 // Tell Windows to send us a paint event if we're in WM_SIZE/WM_MOVE; posted events497 // are blocked until the mouse button is released. See task 146849.498 const QRegion rgn(qt_dirtyRegion(widget));499 InvalidateRgn(widget->internalWinId(), rgn.handle(), false);500 qt_widget_private(widget)->dirty = QRegion();501 return;502 }503 #endif504 505 501 if (updateImmediately) { 506 502 QEvent event(QEvent::UpdateRequest); … … 533 529 Q_ASSERT(widget->window() == tlw); 534 530 Q_ASSERT(!rgn.isEmpty()); 531 532 #ifndef QT_NO_GRAPHICSEFFECT 533 widget->d_func()->invalidateGraphicsEffectsRecursively(); 534 #endif //QT_NO_GRAPHICSEFFECT 535 535 536 536 if (widget->d_func()->paintOnScreen()) { … … 553 553 554 554 const QPoint offset = widget->mapTo(tlw, QPoint()); 555 if (qt_region_strictContains(dirty, widget->rect().translated(offset))) { 555 const QRect widgetRect = widget->d_func()->effectiveRectFor(widget->rect()); 556 if (qt_region_strictContains(dirty, widgetRect.translated(offset))) { 556 557 if (updateImmediately) 557 558 sendUpdateRequest(tlw, updateImmediately); … … 561 562 if (invalidateBuffer) { 562 563 const bool eventAlreadyPosted = !dirty.isEmpty(); 563 dirty += rgn.translated(offset); 564 #ifndef QT_NO_GRAPHICSEFFECT 565 if (widget->d_func()->graphicsEffect) 566 dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()).translated(offset); 567 else 568 #endif //QT_NO_GRAPHICSEFFECT 569 dirty += rgn.translated(offset); 564 570 if (!eventAlreadyPosted || updateImmediately) 565 571 sendUpdateRequest(tlw, updateImmediately); … … 574 580 575 581 if (widget->d_func()->inDirtyList) { 576 if (!qt_region_strictContains(widget->d_func()->dirty, widget->rect())) 577 widget->d_func()->dirty += rgn; 582 if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) { 583 #ifndef QT_NO_GRAPHICSEFFECT 584 if (widget->d_func()->graphicsEffect) 585 widget->d_func()->dirty += widget->d_func()->effectiveRectFor(rgn.boundingRect()); 586 else 587 #endif //QT_NO_GRAPHICSEFFECT 588 widget->d_func()->dirty += rgn; 589 } 578 590 } else { 579 591 addDirtyWidget(widget, rgn); … … 600 612 Q_ASSERT(widget->window() == tlw); 601 613 Q_ASSERT(!rect.isEmpty()); 614 615 #ifndef QT_NO_GRAPHICSEFFECT 616 widget->d_func()->invalidateGraphicsEffectsRecursively(); 617 #endif //QT_NO_GRAPHICSEFFECT 602 618 603 619 if (widget->d_func()->paintOnScreen()) { … … 619 635 } 620 636 621 const QRect translatedRect(rect.translated(widget->mapTo(tlw, QPoint()))); 637 const QRect widgetRect = widget->d_func()->effectiveRectFor(rect); 638 const QRect translatedRect(widgetRect.translated(widget->mapTo(tlw, QPoint()))); 622 639 if (qt_region_strictContains(dirty, translatedRect)) { 623 640 if (updateImmediately) … … 641 658 642 659 if (widget->d_func()->inDirtyList) { 643 if (!qt_region_strictContains(widget->d_func()->dirty, rect))644 widget->d_func()->dirty += rect;660 if (!qt_region_strictContains(widget->d_func()->dirty, widgetRect)) 661 widget->d_func()->dirty += widgetRect; 645 662 } else { 646 663 addDirtyWidget(widget, rect); … … 758 775 759 776 QPainter painter(windowSurface->paintDevice()); 760 painter.setFont( qApp->font());777 painter.setFont(QApplication::font()); 761 778 painter.translate(tlwOffset); 762 779 … … 826 843 QWidgetBackingStore::~QWidgetBackingStore() 827 844 { 845 for (int c = 0; c < dirtyWidgets.size(); ++c) { 846 resetWidget(dirtyWidgets.at(c)); 847 } 848 828 849 delete windowSurface; 829 850 windowSurface = 0; … … 837 858 { 838 859 Q_Q(QWidget); 839 if (!q->isVisible() )860 if (!q->isVisible() || (dx == 0 && dy == 0)) 840 861 return; 841 862 … … 867 888 868 889 bool accelerateMove = accelEnv && isOpaque 869 #ifndef QT_NO_GRAPHICS CVIEW890 #ifndef QT_NO_GRAPHICSVIEW 870 891 // No accelerate move for proxy widgets. 871 892 && !tlw->d_func()->extra->proxyWidget … … 874 895 875 896 if (!accelerateMove) { 876 QRegion parentR( parentRect);897 QRegion parentR(effectiveRectFor(parentRect)); 877 898 if (!extra || !extra->hasMask) { 878 899 parentR -= newRect; … … 929 950 930 951 QWidgetBackingStore *wbs = x->backingStore; 952 if (!wbs) 953 return; 931 954 932 955 static int accelEnv = -1; … … 1165 1188 toClean += widgetDirty; 1166 1189 1167 #ifndef QT_NO_GRAPHICS CVIEW1190 #ifndef QT_NO_GRAPHICSVIEW 1168 1191 if (tlw->d_func()->extra->proxyWidget) { 1169 1192 resetWidget(w); … … 1347 1370 { 1348 1371 Q_ASSERT(widget); 1349 if ( qApp && qApp->closingDown())1372 if (QApplication::closingDown()) 1350 1373 return true; 1351 1374 … … 1378 1401 const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height()); 1379 1402 1380 if (!staticContents ) {1403 if (!staticContents || graphicsEffect) { 1381 1404 QRegion staticChildren; 1382 1405 QWidgetBackingStore *bs = 0; … … 1398 1421 1399 1422 // Invalidate newly exposed area of the parent. 1400 if ( extra && extra->hasMask) {1423 if (!graphicsEffect && extra && extra->hasMask) { 1401 1424 QRegion parentExpose(extra->mask.translated(oldPos)); 1402 1425 parentExpose &= QRect(oldPos, oldSize); … … 1405 1428 q->parentWidget()->d_func()->invalidateBuffer(parentExpose); 1406 1429 } else { 1407 if (hasStaticChildren ) {1430 if (hasStaticChildren && !graphicsEffect) { 1408 1431 QRegion parentExpose(QRect(oldPos, oldSize)); 1409 1432 parentExpose -= data.crect; // Offset is unchanged, safe to do this. 1410 1433 q->parentWidget()->d_func()->invalidateBuffer(parentExpose); 1411 1434 } else { 1412 q->parentWidget()->d_func()->invalidateBuffer( QRect(oldPos, oldSize));1435 q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize))); 1413 1436 } 1414 1437 } … … 1468 1491 QRegion wrgn(rgn); 1469 1492 wrgn &= clipRect(); 1470 if ( extra && extra->hasMask)1493 if (!graphicsEffect && extra && extra->hasMask) 1471 1494 wrgn &= extra->mask; 1472 1495 if (wrgn.isEmpty()) … … 1496 1519 return; 1497 1520 1498 if ( !extra || !extra->hasMask) {1521 if (graphicsEffect || !extra || !extra->hasMask) { 1499 1522 tlwExtra->backingStore->markDirty(wRect, q, false, true); 1500 1523 return; … … 1511 1534 void QWidgetPrivate::repaint_sys(const QRegion &rgn) 1512 1535 { 1536 if (data.in_destructor) 1537 return; 1538 1513 1539 Q_Q(QWidget); 1514 1540 if (q->testAttribute(Qt::WA_StaticContents)) { … … 1518 1544 } 1519 1545 1546 QPaintEngine *engine = q->paintEngine(); 1547 // QGLWidget does not support partial updates if: 1548 // 1) The context is double buffered 1549 // 2) The context is single buffered and auto-fill background is enabled. 1550 const bool noPartialUpdateSupport = (engine && (engine->type() == QPaintEngine::OpenGL 1551 || engine->type() == QPaintEngine::OpenGL2)) 1552 && (usesDoubleBufferedGLContext || q->autoFillBackground()); 1553 QRegion toBePainted(noPartialUpdateSupport ? q->rect() : rgn); 1554 1520 1555 #ifdef Q_WS_MAC 1521 1556 // No difference between update() and repaint() on the Mac. 1522 update_sys( rgn);1557 update_sys(toBePainted); 1523 1558 return; 1524 1559 #endif 1525 1560 1526 QRegion toBePainted(rgn);1527 1561 toBePainted &= clipRect(); 1528 1562 clipToEffectiveMask(toBePainted);
Note:
See TracChangeset
for help on using the changeset viewer.