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/qbrush.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)
     
    4949#include "qdebug.h"
    5050#include <QtCore/qcoreapplication.h>
     51#include "private/qstylehelper_p.h"
    5152
    5253QT_BEGIN_NAMESPACE
     
    9798QPixmap qt_pixmapForBrush(int brushStyle, bool invert)
    9899{
     100
    99101    QPixmap pm;
    100     QString key = QLatin1String("$qt-brush$") + QString::number(brushStyle)
    101                   + QString::number((int)invert);
     102    QString key = QLatin1Literal("$qt-brush$")
     103                  % HexString<uint>(brushStyle)
     104                  % QLatin1Char(invert ? '1' : '0');
    102105    if (!QPixmapCache::find(key, pm)) {
    103106        pm = QBitmap::fromData(QSize(8, 8), qt_patternForBrush(brushStyle, invert),
     
    330333    \endtable
    331334
    332     For more information about painting in general, see \l{The Paint
    333     System} documentation.
     335    For more information about painting in general, see the \l{Paint
     336    System}.
    334337
    335338    \sa Qt::BrushStyle, QPainter, QColor
     
    912915
    913916    Two brushes are different if they have different styles, colors or
    914     pixmaps.
     917    transforms or different pixmaps or gradients depending on the style.
    915918
    916919    \sa operator==()
     
    924927
    925928    Two brushes are equal if they have equal styles, colors and
    926     pixmaps.
     929    transforms and equal pixmaps or gradients depending on the style.
    927930
    928931    \sa operator!=()
     
    933936    if (b.d == d)
    934937        return true;
    935     if (b.d->style == d->style && b.d->color == d->color) {
    936         switch (d->style) {
    937         case Qt::TexturePattern: {
    938             QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
    939             QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
     938    if (b.d->style != d->style || b.d->color != d->color || b.d->transform != d->transform)
     939        return false;
     940    switch (d->style) {
     941    case Qt::TexturePattern:
     942        {
     943            const QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
     944            const QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
    940945            return ((us.isNull() && them.isNull()) || us.cacheKey() == them.cacheKey());
    941946        }
    942         case Qt::LinearGradientPattern:
    943         case Qt::RadialGradientPattern:
    944         case Qt::ConicalGradientPattern:
    945             {
    946                 QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
    947                 QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
    948                 return d1->gradient == d2->gradient;
    949             }
    950         default:
    951             return true;
     947    case Qt::LinearGradientPattern:
     948    case Qt::RadialGradientPattern:
     949    case Qt::ConicalGradientPattern:
     950        {
     951            const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
     952            const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
     953            return d1->gradient == d2->gradient;
    952954        }
    953     }
    954     return false;
     955    default:
     956        return true;
     957    }
    955958}
    956959
     
    10141017    reference to the \a stream.
    10151018
    1016     \sa {Format of the QDataStream Operators}
     1019    \sa {Serializing Qt Data Types}
    10171020*/
    10181021
     
    10821085    reference to the \a stream.
    10831086
    1084     \sa {Format of the QDataStream Operators}
     1087    \sa {Serializing Qt Data Types}
    10851088*/
    10861089
     
    12161219    \endtable
    12171220
    1218     The colors in a gradient is defined using stop points of the
    1219     QGradientStop type, i.e. a position and a color.  Use the
    1220     setColorAt() function to define a single stop
    1221     point. Alternatively, use the setStops() function to define
    1222     several stop points in one go. Note that the latter function \e
    1223     replaces the current set of stop points.
     1221    The colors in a gradient are defined using stop points of the
     1222    QGradientStop type; i.e., a position and a color. Use the setColorAt()
     1223    function to define a single stop point. Alternatively, use the
     1224    setStops() function to define several stop points in one go. Note that
     1225    the latter function \e replaces the current set of stop points.
    12241226
    12251227    It is the gradient's complete set of stop points (accessible
    12261228    through the stops() function) that describes how the gradient area
    1227     should be filled. If no stop points have been specified, a
    1228     gradient of black at 0 to white at 1 is used.
     1229    should be filled. If no stop points have been specified, a gradient
     1230    of black at 0 to white at 1 is used.
    12291231
    12301232    A diagonal linear gradient from black at (100, 100) to white at
Note: See TracChangeset for help on using the changeset viewer.