QRegion: ensure that shared_empty is constinit
Since 9ecb429986cc547af448f90589694f786ef5f139, empty QLists are constinit (default ctor is constexpr), but QRegionPrivate wasn't, leading to runtime initialization of shared_empty (at least its external state, qrp). Add the missing constexpr to QRegionPrivate's default ctor and statically assert constinit initialization of the static qrp instance and of the shared_empty QRegionData that wraps it, for a tiny speedup of application startup. Task-number: QTBUG-100486 Change-Id: Iaf80207e0114e94affc5fc0d365a7c2c33ae5f68 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
dcc11ef277
commit
ca05ba3e49
@ -1085,7 +1085,7 @@ struct QRegionPrivate {
|
||||
QRect extents;
|
||||
QRect innerRect;
|
||||
|
||||
inline QRegionPrivate() : numRects(0), innerArea(-1) {}
|
||||
constexpr QRegionPrivate() : numRects(0), innerArea(-1) {}
|
||||
inline QRegionPrivate(const QRect &r)
|
||||
: numRects(1),
|
||||
innerArea(r.width() * r.height()),
|
||||
@ -1594,8 +1594,8 @@ void QRegionPrivate::selfTest() const
|
||||
}
|
||||
#endif // QT_REGION_DEBUG
|
||||
|
||||
static QRegionPrivate qrp;
|
||||
const QRegion::QRegionData QRegion::shared_empty = {Q_REFCOUNT_INITIALIZE_STATIC, &qrp};
|
||||
Q_CONSTINIT static QRegionPrivate qrp;
|
||||
Q_CONSTINIT const QRegion::QRegionData QRegion::shared_empty = {Q_REFCOUNT_INITIALIZE_STATIC, &qrp};
|
||||
|
||||
typedef void (*OverlapFunc)(QRegionPrivate &dest, const QRect *r1, const QRect *r1End,
|
||||
const QRect *r2, const QRect *r2End, int y1, int y2);
|
||||
|
Loading…
x
Reference in New Issue
Block a user