Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

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

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    712712
    713713/*!
     714    \fn bool QRegion::intersects(const QRect &rect) const
    714715    \since 4.2
    715716
     
    717718    returns false.
    718719*/
    719 bool QRegion::intersects(const QRect &rect) const
    720 {
    721     if (isEmpty() || rect.isNull())
    722         return false;
    723 
    724     const QRect r = rect.normalized();
    725     if (!rect_intersects(boundingRect(), r))
    726         return false;
    727     if (rectCount() == 1)
    728         return true;
    729 
    730     const QVector<QRect> myRects = rects();
    731     for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
    732         if (rect_intersects(r, *it))
    733             return true;
    734     return false;
    735 }
     720
    736721
    737722#if !defined (Q_OS_UNIX) && !defined (Q_WS_WIN) && !defined (Q_WS_PM)
     
    17261711QT_END_INCLUDE_NAMESPACE
    17271712
    1728 /*  1 if two BOXs overlap.
    1729  *  0 if two BOXs do not overlap.
     1713/*  1 if two BOXes overlap.
     1714 *  0 if two BOXes do not overlap.
    17301715 *  Remember, x2 and y2 are not in the region
    17311716 */
     
    43764361}
    43774362
     4363bool QRegion::intersects(const QRect &rect) const
     4364{
     4365    if (isEmptyHelper(d->qt_rgn) || rect.isNull())
     4366        return false;
     4367
     4368    const QRect r = rect.normalized();
     4369    if (!rect_intersects(d->qt_rgn->extents, r))
     4370        return false;
     4371    if (d->qt_rgn->numRects == 1)
     4372        return true;
     4373
     4374    const QVector<QRect> myRects = rects();
     4375    for (QVector<QRect>::const_iterator it = myRects.constBegin(); it < myRects.constEnd(); ++it)
     4376        if (rect_intersects(r, *it))
     4377            return true;
     4378    return false;
     4379}
     4380
     4381
    43784382#endif
    43794383QT_END_NAMESPACE
Note: See TracChangeset for help on using the changeset viewer.