Changeset 561 for trunk/src/gui/painting/qpainterpath_p.h
- 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/painting/qpainterpath_p.h
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 ** … … 82 82 { 83 83 public: 84 QVectorPathConverter(const QVector<QPainterPath::Element> &path, uint fillRule )85 : pathData(path, fillRule ),84 QVectorPathConverter(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex) 85 : pathData(path, fillRule, convex), 86 86 path(pathData.points.data(), path.size(), 87 87 pathData.elements.data(), pathData.flags) {} … … 92 92 93 93 struct QVectorPathData { 94 QVectorPathData(const QVector<QPainterPath::Element> &path, uint fillRule )94 QVectorPathData(const QVector<QPainterPath::Element> &path, uint fillRule, bool convex) 95 95 : elements(path.size()), 96 96 points(path.size() * 2), … … 104 104 points[ptsPos++] = e.y; 105 105 if (e.type == QPainterPath::CurveToElement) 106 flags |= QVectorPath::CurvedShape Hint;106 flags |= QVectorPath::CurvedShapeMask; 107 107 } 108 108 … … 112 112 flags |= QVectorPath::OddEvenFill; 113 113 114 if (!convex) 115 flags |= QVectorPath::NonConvexShapeMask; 114 116 } 115 117 QVarLengthArray<QPainterPath::ElementType> elements; … … 125 127 }; 126 128 127 class Q _GUI_EXPORT QPainterPathData : public QPainterPathPrivate129 class QPainterPathData : public QPainterPathPrivate 128 130 { 129 131 public: 130 132 QPainterPathData() : 131 cStart(0), fillRule(Qt::OddEvenFill), 132 dirtyBounds(false), dirtyControlBounds(false), 133 cStart(0), 134 fillRule(Qt::OddEvenFill), 135 dirtyBounds(false), 136 dirtyControlBounds(false), 133 137 pathConverter(0) 134 138 { 135 139 ref = 1; 136 140 require_moveTo = false; 141 convex = false; 137 142 } 138 143 139 144 QPainterPathData(const QPainterPathData &other) : 140 145 QPainterPathPrivate(), cStart(other.cStart), fillRule(other.fillRule), 141 dirtyBounds(other.dirtyBounds), bounds(other.bounds), 146 bounds(other.bounds), 147 controlBounds(other.controlBounds), 148 dirtyBounds(other.dirtyBounds), 142 149 dirtyControlBounds(other.dirtyControlBounds), 143 con trolBounds(other.controlBounds),150 convex(other.convex), 144 151 pathConverter(0) 145 152 { … … 159 166 const QVectorPath &vectorPath() { 160 167 if (!pathConverter) 161 pathConverter = new QVectorPathConverter(elements, fillRule );168 pathConverter = new QVectorPathConverter(elements, fillRule, convex); 162 169 return pathConverter->path; 163 170 } … … 166 173 Qt::FillRule fillRule; 167 174 168 bool require_moveTo;169 170 bool dirtyBounds;171 175 QRectF bounds; 172 bool dirtyControlBounds;173 176 QRectF controlBounds; 177 178 uint require_moveTo : 1; 179 uint dirtyBounds : 1; 180 uint dirtyControlBounds : 1; 181 uint convex : 1; 174 182 175 183 QVectorPathConverter *pathConverter; … … 177 185 178 186 187 inline const QPainterPath QVectorPath::convertToPainterPath() const 188 { 189 QPainterPath path; 190 path.ensureData(); 191 QPainterPathData *data = path.d_func(); 192 data->elements.reserve(m_count); 193 int index = 0; 194 data->elements[0].x = m_points[index++]; 195 data->elements[0].y = m_points[index++]; 196 197 if (m_elements) { 198 data->elements[0].type = m_elements[0]; 199 for (int i=1; i<m_count; ++i) { 200 QPainterPath::Element element; 201 element.x = m_points[index++]; 202 element.y = m_points[index++]; 203 element.type = m_elements[i]; 204 data->elements << element; 205 } 206 } else { 207 data->elements[0].type = QPainterPath::MoveToElement; 208 for (int i=1; i<m_count; ++i) { 209 QPainterPath::Element element; 210 element.x = m_points[index++]; 211 element.y = m_points[index++]; 212 element.type = QPainterPath::LineToElement; 213 data->elements << element; 214 } 215 } 216 217 if (m_hints & OddEvenFill) 218 data->fillRule = Qt::OddEvenFill; 219 else 220 data->fillRule = Qt::WindingFill; 221 return path; 222 } 179 223 180 224 void Q_GUI_EXPORT qt_find_ellipse_coords(const QRectF &r, qreal angle, qreal length,
Note:
See TracChangeset
for help on using the changeset viewer.