diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-24 02:04:09 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-11 19:25:31 +0000 |
commit | 2523f62939948f383178054c2d061711c0413348 (patch) | |
tree | 2b053608f608b130837fe89132b09e9c49229116 /src/gui/painting/qpainter_p.h | |
parent | 612e082fe2ad16fa4ba251c435092547efff69a1 (diff) |
QPainter: replace an inefficient QList with QVector
QPainterClipInfo is larger than a void*, so holding it in QLists
is needlessly inefficient. Worse, the code could come to depend
on the fragile property of (inefficient) QLists that references
to elements therein never are invalidated.
Fix by marking it movable and holding it in a QVector instead.
Port from op<< to append() to reap rvalue push_back().
Change-Id: I3af17eca2443d26a795381635510b8b9a5795e5f
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'src/gui/painting/qpainter_p.h')
-rw-r--r-- | src/gui/painting/qpainter_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index b916d0a428..23ab5db7b4 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -97,6 +97,7 @@ inline bool qbrush_has_transform(const QBrush &b) { return data_ptr(b)->transfor class QPainterClipInfo { public: + QPainterClipInfo() {} // for QVector, don't use enum ClipType { RegionClip, PathClip, RectClip, RectFClip }; QPainterClipInfo(const QPainterPath &p, Qt::ClipOperation op, const QTransform &m) : @@ -134,6 +135,7 @@ public: }; +Q_DECLARE_TYPEINFO(QPainterClipInfo, Q_MOVABLE_TYPE); class Q_GUI_EXPORT QPainterState : public QPaintEngineState { @@ -153,7 +155,7 @@ public: QPainterPath clipPath; Qt::ClipOperation clipOperation; QPainter::RenderHints renderHints; - QList<QPainterClipInfo> clipInfo; // ### Make me smaller and faster to copy around... + QVector<QPainterClipInfo> clipInfo; // ### Make me smaller and faster to copy around... QTransform worldMatrix; // World transformation matrix, not window and viewport QTransform matrix; // Complete transformation matrix, QTransform redirectionMatrix; |