From ebbfc556678f1c780e0bd1efde23835d023f95ad Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 24 Apr 2016 00:07:28 +0200 Subject: QtGui: mark more types as primitive/movable These types are held in QVarLengthArrays, so benefit from being trivially relocatable. They are also part of the private API, so there's no BC issues with potential uses of these types in QList, except for QPainter::PixmapFragment, which consequently has been marked as relocatable only. Change-Id: I90fb9a19231c6f5c71c593602fc997ffafe8f047 Reviewed-by: Lars Knoll --- src/gui/painting/qregion.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gui/painting/qregion.cpp') diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 35c4abb3ac..d38479c4b1 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -1047,7 +1047,15 @@ void addSegmentsToPath(Segment *segment, QPainterPath &path) } } -} +} // unnamed namespace + +// the following is really a lie, because Segments cannot be relocated, as they +// reference each other by address. For the same reason, they aren't even copyable, +// but the code works with the compiler-generated (wrong) copy and move special +// members, so use this as an optimization. The only container these are used in +// (a QVarLengthArray in qt_regionToPath()) is resized once up-front, so doesn't +// have a problem with this, but benefits from not having to run Segment ctors: +Q_DECLARE_TYPEINFO(Segment, Q_PRIMITIVE_TYPE); Q_GUI_EXPORT QPainterPath qt_regionToPath(const QRegion ®ion) { -- cgit v1.2.3