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/image/qpicture.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**
     
    7070    replays QPainter commands.
    7171
    72     \ingroup multimedia
     72    \ingroup painting
    7373    \ingroup shared
    74     \mainclass
     74
    7575
    7676    A picture serializes painter commands to an IO device in a
     
    132132{
    133133    Q_D(QPicture);
    134     d_ptr->q_ptr = this;
    135     d->paintEngine = 0;
    136134
    137135    if (formatVersion == 0)
     
    143141        d->formatMinor = 0;
    144142        d->formatOk = false;
    145     }
    146     else {
     143    } else {
    147144        d->resetFormat();
    148145    }
     
    158155    : QPaintDevice(), d_ptr(pic.d_ptr)
    159156{
    160     d_func()->ref.ref();
    161157}
    162158
     
    166162      d_ptr(&dptr)
    167163{
    168     d_ptr->q_ptr = this;
    169164}
    170165
     
    174169QPicture::~QPicture()
    175170{
    176     if (!d_func()->ref.deref()) {
    177         delete d_func()->paintEngine;
    178         delete d_func();
    179     }
    180171}
    181172
     
    231222void QPicture::detach()
    232223{
    233     if (d_func()->ref != 1)
    234         detach_helper();
     224    d_ptr.detach();
    235225}
    236226
     
    955945
    956946/*!
     947    \internal
     948
    957949    Internal implementation of the virtual QPaintDevice::metric()
    958950    function.
     
    10161008\internal
    10171009*/
     1010
     1011/*! \internal
     1012### Qt 5 - remove me
     1013 */
    10181014void QPicture::detach_helper()
    10191015{
    1020     Q_D(QPicture);
    1021     QPicturePrivate *x = new QPicturePrivate;
    1022     int pictsize = size();
    1023     x->pictb.setData(data(), pictsize);
    1024     if (d->pictb.isOpen()) {
    1025         x->pictb.open(d->pictb.openMode());
    1026         x->pictb.seek(d->pictb.pos());
    1027     }
    1028     x->trecs = d->trecs;
    1029     x->formatOk = d->formatOk;
    1030     x->formatMinor = d->formatMinor;
    1031     x->brect = d->brect;
    1032     x->override_rect = d->override_rect;
    1033     if (!d->ref.deref())
    1034         delete d;
    1035     d_ptr = x;
     1016    // QExplicitelySharedDataPointer takes care of cloning using
     1017    // QPicturePrivate's copy constructor. Do not call detach_helper() anymore
     1018    // and remove in Qt 5, please.
     1019    Q_ASSERT_X(false, "QPicture::detach_helper()", "Do not call this function");
    10361020}
    10371021
     
    10421026QPicture& QPicture::operator=(const QPicture &p)
    10431027{
    1044     qAtomicAssign<QPicturePrivate>(d_ptr, p.d_ptr);
     1028    d_ptr = p.d_ptr;
    10451029    return *this;
     1030}
     1031
     1032/*!
     1033  \internal
     1034
     1035  Constructs a QPicturePrivate
     1036*/
     1037QPicturePrivate::QPicturePrivate()
     1038    : in_memory_only(false)
     1039{
     1040}
     1041
     1042/*!
     1043  \internal
     1044
     1045  Copy-Constructs a QPicturePrivate. Needed when detaching.
     1046*/
     1047QPicturePrivate::QPicturePrivate(const QPicturePrivate &other)
     1048    : trecs(other.trecs),
     1049      formatOk(other.formatOk),
     1050      formatMinor(other.formatMinor),
     1051      brect(other.brect),
     1052      override_rect(other.override_rect),
     1053      in_memory_only(false)
     1054{
     1055    pictb.setData(other.pictb.data(), other.pictb.size());
     1056    if (other.pictb.isOpen()) {
     1057        pictb.open(other.pictb.openMode());
     1058        pictb.seek(other.pictb.pos());
     1059    }
    10461060}
    10471061
     
    11361150{
    11371151    if (!d_func()->paintEngine)
    1138         const_cast<QPicture*>(this)->d_func()->paintEngine = new QPicturePaintEngine;
    1139     return d_func()->paintEngine;
     1152        const_cast<QPicture*>(this)->d_func()->paintEngine.reset(new QPicturePaintEngine);
     1153    return d_func()->paintEngine.data();
    11401154}
    11411155
     
    11441158 *****************************************************************************/
    11451159
     1160#ifndef QT_NO_DATASTREAM
    11461161/*!
    11471162    \relates QPicture
     
    11891204    return s;
    11901205}
     1206#endif // QT_NO_DATASTREAM
    11911207
    11921208
     
    12951311    saving pictures.
    12961312
    1297     \ingroup multimedia
     1313    \ingroup painting
    12981314    \ingroup io
    12991315
Note: See TracChangeset for help on using the changeset viewer.