Changeset 561 for trunk/src/gui/image/qpicture.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/image/qpicture.cpp
r2 r561 2 2 ** 3 3 ** 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) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 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. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** 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. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 70 70 replays QPainter commands. 71 71 72 \ingroup multimedia72 \ingroup painting 73 73 \ingroup shared 74 \mainclass 74 75 75 76 76 A picture serializes painter commands to an IO device in a … … 132 132 { 133 133 Q_D(QPicture); 134 d_ptr->q_ptr = this;135 d->paintEngine = 0;136 134 137 135 if (formatVersion == 0) … … 143 141 d->formatMinor = 0; 144 142 d->formatOk = false; 145 } 146 else { 143 } else { 147 144 d->resetFormat(); 148 145 } … … 158 155 : QPaintDevice(), d_ptr(pic.d_ptr) 159 156 { 160 d_func()->ref.ref();161 157 } 162 158 … … 166 162 d_ptr(&dptr) 167 163 { 168 d_ptr->q_ptr = this;169 164 } 170 165 … … 174 169 QPicture::~QPicture() 175 170 { 176 if (!d_func()->ref.deref()) {177 delete d_func()->paintEngine;178 delete d_func();179 }180 171 } 181 172 … … 231 222 void QPicture::detach() 232 223 { 233 if (d_func()->ref != 1) 234 detach_helper(); 224 d_ptr.detach(); 235 225 } 236 226 … … 955 945 956 946 /*! 947 \internal 948 957 949 Internal implementation of the virtual QPaintDevice::metric() 958 950 function. … … 1016 1008 \internal 1017 1009 */ 1010 1011 /*! \internal 1012 ### Qt 5 - remove me 1013 */ 1018 1014 void QPicture::detach_helper() 1019 1015 { 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"); 1036 1020 } 1037 1021 … … 1042 1026 QPicture& QPicture::operator=(const QPicture &p) 1043 1027 { 1044 qAtomicAssign<QPicturePrivate>(d_ptr, p.d_ptr);1028 d_ptr = p.d_ptr; 1045 1029 return *this; 1030 } 1031 1032 /*! 1033 \internal 1034 1035 Constructs a QPicturePrivate 1036 */ 1037 QPicturePrivate::QPicturePrivate() 1038 : in_memory_only(false) 1039 { 1040 } 1041 1042 /*! 1043 \internal 1044 1045 Copy-Constructs a QPicturePrivate. Needed when detaching. 1046 */ 1047 QPicturePrivate::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 } 1046 1060 } 1047 1061 … … 1136 1150 { 1137 1151 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(); 1140 1154 } 1141 1155 … … 1144 1158 *****************************************************************************/ 1145 1159 1160 #ifndef QT_NO_DATASTREAM 1146 1161 /*! 1147 1162 \relates QPicture … … 1189 1204 return s; 1190 1205 } 1206 #endif // QT_NO_DATASTREAM 1191 1207 1192 1208 … … 1295 1311 saving pictures. 1296 1312 1297 \ingroup multimedia1313 \ingroup painting 1298 1314 \ingroup io 1299 1315
Note:
See TracChangeset
for help on using the changeset viewer.