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/corelib/tools/qrect.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtCore 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
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    5151/*!
    5252    \class QRect
    53     \ingroup multimedia
     53    \ingroup
    5454
    5555    \brief The QRect class defines a rectangle in the plane using
     
    902902    \fn bool QRect::contains(const QPoint &point, bool proper) const
    903903
    904     Returns true if the the given \a point is inside or on the edge of
     904    Returns true if the given \a point is inside or on the edge of
    905905    the rectangle, otherwise returns false. If \a proper is true, this
    906906    function only returns true if the given \a point is \e inside the
     
    13251325/*!
    13261326    \class QRectF
    1327     \ingroup multimedia
     1327    \ingroup
    13281328
    13291329    \brief The QRectF class defines a rectangle in the plane using floating
     
    21552155QRectF QRectF::operator|(const QRectF &r) const
    21562156{
    2157     qreal l1 = xp;
    2158     qreal r1 = xp;
     2157    if (isNull())
     2158        return r;
     2159    if (r.isNull())
     2160        return *this;
     2161
     2162    qreal left = xp;
     2163    qreal right = xp;
    21592164    if (w < 0)
    2160         l1 += w;
    2161     else
    2162         r1 += w;
    2163     if (l1 == r1) // null rect
    2164         return r;
    2165 
    2166     qreal l2 = r.xp;
    2167     qreal r2 = r.xp;
    2168     if (r.w < 0)
    2169         l2 += r.w;
    2170     else
    2171         r2 += r.w;
    2172     if (l2 == r2) // null rect
    2173         return *this;
    2174 
    2175     qreal t1 = yp;
    2176     qreal b1 = yp;
     2165        left += w;
     2166    else
     2167        right += w;
     2168
     2169    if (r.w < 0) {
     2170        left = qMin(left, r.xp + r.w);
     2171        right = qMax(right, r.xp);
     2172    } else {
     2173        left = qMin(left, r.xp);
     2174        right = qMax(right, r.xp + r.w);
     2175    }
     2176
     2177    qreal top = yp;
     2178    qreal bottom = yp;
    21772179    if (h < 0)
    2178         t1 += h;
    2179     else
    2180         b1 += h;
    2181     if (t1 == b1) // null rect
    2182         return r;
    2183 
    2184     qreal t2 = r.yp;
    2185     qreal b2 = r.yp;
    2186     if (r.h < 0)
    2187         t2 += r.h;
    2188     else
    2189         b2 += r.h;
    2190     if (t2 == b2) // null rect
    2191         return *this;
    2192 
    2193     QRectF tmp;
    2194     tmp.xp = qMin(l1, l2);
    2195     tmp.yp = qMin(t1, t2);
    2196     tmp.w = qMax(r1, r2) - tmp.xp;
    2197     tmp.h = qMax(b1, b2) - tmp.yp;
    2198     return tmp;
     2180        top += h;
     2181    else
     2182        bottom += h;
     2183
     2184    if (r.h < 0) {
     2185        top = qMin(top, r.yp + r.h);
     2186        bottom = qMax(bottom, r.yp);
     2187    } else {
     2188        top = qMin(top, r.yp);
     2189        bottom = qMax(bottom, r.yp + r.h);
     2190    }
     2191
     2192    return QRectF(left, top, right - left, bottom - top);
    21992193}
    22002194
Note: See TracChangeset for help on using the changeset viewer.