Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/painting/qbackingstore.cpp

    r2 r561  
    22**
    33** 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)
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** 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.
    3838** $QT_END_LICENSE$
    3939**
    4040****************************************************************************/
     41
     42
     43#include "qplatformdefs.h"
    4144
    4245#include "qbackingstore_p.h"
     
    5457#include <private/qapplication_p.h>
    5558#include <private/qpaintengine_raster_p.h>
     59#include <private/qgraphicseffect_p.h>
    5660
    5761#include "qgraphicssystem_p.h"
     
    259263{
    260264    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);
    262269}
    263270
     
    492499        return;
    493500
    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 events
    497         // 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 #endif
    504 
    505501    if (updateImmediately) {
    506502        QEvent event(QEvent::UpdateRequest);
     
    533529    Q_ASSERT(widget->window() == tlw);
    534530    Q_ASSERT(!rgn.isEmpty());
     531
     532#ifndef QT_NO_GRAPHICSEFFECT
     533    widget->d_func()->invalidateGraphicsEffectsRecursively();
     534#endif //QT_NO_GRAPHICSEFFECT
    535535
    536536    if (widget->d_func()->paintOnScreen()) {
     
    553553
    554554    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))) {
    556557        if (updateImmediately)
    557558            sendUpdateRequest(tlw, updateImmediately);
     
    561562    if (invalidateBuffer) {
    562563        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);
    564570        if (!eventAlreadyPosted || updateImmediately)
    565571            sendUpdateRequest(tlw, updateImmediately);
     
    574580
    575581    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        }
    578590    } else {
    579591        addDirtyWidget(widget, rgn);
     
    600612    Q_ASSERT(widget->window() == tlw);
    601613    Q_ASSERT(!rect.isEmpty());
     614
     615#ifndef QT_NO_GRAPHICSEFFECT
     616    widget->d_func()->invalidateGraphicsEffectsRecursively();
     617#endif //QT_NO_GRAPHICSEFFECT
    602618
    603619    if (widget->d_func()->paintOnScreen()) {
     
    619635    }
    620636
    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())));
    622639    if (qt_region_strictContains(dirty, translatedRect)) {
    623640        if (updateImmediately)
     
    641658
    642659    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;
    645662    } else {
    646663        addDirtyWidget(widget, rect);
     
    758775
    759776    QPainter painter(windowSurface->paintDevice());
    760     painter.setFont(qApp->font());
     777    painter.setFont(QApplication::font());
    761778    painter.translate(tlwOffset);
    762779
     
    826843QWidgetBackingStore::~QWidgetBackingStore()
    827844{
     845    for (int c = 0; c < dirtyWidgets.size(); ++c) {
     846        resetWidget(dirtyWidgets.at(c));
     847    }
     848
    828849    delete windowSurface;
    829850    windowSurface = 0;
     
    837858{
    838859    Q_Q(QWidget);
    839     if (!q->isVisible())
     860    if (!q->isVisible() || (dx == 0 && dy == 0))
    840861        return;
    841862
     
    867888
    868889    bool accelerateMove = accelEnv && isOpaque
    869 #ifndef QT_NO_GRAPHICSCVIEW
     890#ifndef QT_NO_GRAPHICSVIEW
    870891                          // No accelerate move for proxy widgets.
    871892                          && !tlw->d_func()->extra->proxyWidget
     
    874895
    875896    if (!accelerateMove) {
    876         QRegion parentR(parentRect);
     897        QRegion parentR(effectiveRectFor(parentRect));
    877898        if (!extra || !extra->hasMask) {
    878899            parentR -= newRect;
     
    929950
    930951    QWidgetBackingStore *wbs = x->backingStore;
     952    if (!wbs)
     953        return;
    931954
    932955    static int accelEnv = -1;
     
    11651188        toClean += widgetDirty;
    11661189
    1167 #ifndef QT_NO_GRAPHICSCVIEW
     1190#ifndef QT_NO_GRAPHICSVIEW
    11681191        if (tlw->d_func()->extra->proxyWidget) {
    11691192            resetWidget(w);
     
    13471370{
    13481371    Q_ASSERT(widget);
    1349     if (qApp && qApp->closingDown())
     1372    if (QApplication::closingDown())
    13501373        return true;
    13511374
     
    13781401    const QRect oldWidgetRect(0, 0, oldSize.width(), oldSize.height());
    13791402
    1380     if (!staticContents) {
     1403    if (!staticContents || graphicsEffect) {
    13811404        QRegion staticChildren;
    13821405        QWidgetBackingStore *bs = 0;
     
    13981421
    13991422        // Invalidate newly exposed area of the parent.
    1400         if (extra && extra->hasMask) {
     1423        if (!graphicsEffect && extra && extra->hasMask) {
    14011424            QRegion parentExpose(extra->mask.translated(oldPos));
    14021425            parentExpose &= QRect(oldPos, oldSize);
     
    14051428            q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
    14061429        } else {
    1407             if (hasStaticChildren) {
     1430            if (hasStaticChildren && !graphicsEffect) {
    14081431                QRegion parentExpose(QRect(oldPos, oldSize));
    14091432                parentExpose -= data.crect; // Offset is unchanged, safe to do this.
    14101433                q->parentWidget()->d_func()->invalidateBuffer(parentExpose);
    14111434            } else {
    1412                 q->parentWidget()->d_func()->invalidateBuffer(QRect(oldPos, oldSize));
     1435                q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(QRect(oldPos, oldSize)));
    14131436            }
    14141437        }
     
    14681491    QRegion wrgn(rgn);
    14691492    wrgn &= clipRect();
    1470     if (extra && extra->hasMask)
     1493    if (!graphicsEffect && extra && extra->hasMask)
    14711494        wrgn &= extra->mask;
    14721495    if (wrgn.isEmpty())
     
    14961519        return;
    14971520
    1498     if (!extra || !extra->hasMask) {
     1521    if (graphicsEffect || !extra || !extra->hasMask) {
    14991522        tlwExtra->backingStore->markDirty(wRect, q, false, true);
    15001523        return;
     
    15111534void QWidgetPrivate::repaint_sys(const QRegion &rgn)
    15121535{
     1536    if (data.in_destructor)
     1537        return;
     1538
    15131539    Q_Q(QWidget);
    15141540    if (q->testAttribute(Qt::WA_StaticContents)) {
     
    15181544    }
    15191545
     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
    15201555#ifdef Q_WS_MAC
    15211556    // No difference between update() and repaint() on the Mac.
    1522     update_sys(rgn);
     1557    update_sys(toBePainted);
    15231558    return;
    15241559#endif
    15251560
    1526     QRegion toBePainted(rgn);
    15271561    toBePainted &= clipRect();
    15281562    clipToEffectiveMask(toBePainted);
Note: See TracChangeset for help on using the changeset viewer.