diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-08-25 12:07:52 (GMT) |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-08-25 14:25:47 (GMT) |
commit | f393f7f45b22990ed22308a912b7a00cc7ddd78e (patch) | |
tree | b68641f71dcded166f9ae61a07c0a965672087e0 /src/gui/painting/qpainterpath.cpp | |
parent | 48489988521b818bda8d76e60cb272508e91b490 (diff) | |
download | Qt-f393f7f45b22990ed22308a912b7a00cc7ddd78e.zip Qt-f393f7f45b22990ed22308a912b7a00cc7ddd78e.tar.gz Qt-f393f7f45b22990ed22308a912b7a00cc7ddd78e.tar.bz2 |
Micro-optimization in QPainterPath::toFillPolygons
QRectF::intersects was optimized as part of the Falcon project, and is
now a bit faster than the inline version used here (drawing of dashed
lines was measured to take 16% less time).
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index eb8b964..a10c4cd 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1520,12 +1520,6 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const return toSubpathPolygons(QTransform(matrix)); } -static inline bool rect_intersects(const QRectF &r1, const QRectF &r2) -{ - return qMax(r1.left(), r2.left()) <= qMin(r1.right(), r2.right()) - && qMax(r1.top(), r2.top()) <= qMin(r1.bottom(), r2.bottom()); -} - /*! Converts the path into a list of polygons using the QTransform \a matrix, and returns the list. @@ -1578,7 +1572,7 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const continue; QRectF cbounds = bounds.at(j); for (int i=0; i<count; ++i) { - if (rect_intersects(cbounds, bounds.at(i))) { + if (cbounds.intersects(bounds.at(i))) { isects[j] << i; } } |