summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-03-15 21:20:46 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-03-19 16:32:21 +0000
commitf36a013be529b32a0f1b8e2fffb3153609f15ccd (patch)
tree6b5e01974c3bda3229436b4e052664527799c639 /src/gui/text
parent874687902df20f0fdd0b39d84ffd89e6668e1088 (diff)
QtGui: compile-optimize inline swap functions
Instead of using the overly-generic qSwap() monster, use - qt_ptr_swap() for swapping raw pointers - member-swap for swapping smart pointers - std::swap() for swapping scalars In QtCore, this has proven to give a nice reduction in compile time for Qt users, cf. b1b0c2970e480ef460a61f37fa430dc443390358. Task-number: QTBUG-97601 Change-Id: I987ff95e8751a22a4f283655d8225dd16de21178 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c839efb07a6aa3b487dac5f86f905f35ef2c3a08) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qfont.h4
-rw-r--r--src/gui/text/qfontinfo.h2
-rw-r--r--src/gui/text/qfontmetrics.h4
-rw-r--r--src/gui/text/qglyphrun.h2
-rw-r--r--src/gui/text/qrawfont.h2
-rw-r--r--src/gui/text/qstatictext.h2
-rw-r--r--src/gui/text/qtextcursor.h2
-rw-r--r--src/gui/text/qtextformat.h2
8 files changed, 10 insertions, 10 deletions
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 1e1b97667f..2b8b93c0bb 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -174,8 +174,8 @@ public:
QFont(const QFont &font);
~QFont();
- void swap(QFont &other)
- { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); }
+ void swap(QFont &other) noexcept
+ { d.swap(other.d); std::swap(resolve_mask, other.resolve_mask); }
QString family() const;
void setFamily(const QString &);
diff --git a/src/gui/text/qfontinfo.h b/src/gui/text/qfontinfo.h
index ed889c2fb5..349daa3f84 100644
--- a/src/gui/text/qfontinfo.h
+++ b/src/gui/text/qfontinfo.h
@@ -56,7 +56,7 @@ public:
QFontInfo &operator=(const QFontInfo &);
- void swap(QFontInfo &other) { qSwap(d, other.d); }
+ void swap(QFontInfo &other) noexcept { d.swap(other.d); }
QString family() const;
QString styleName() const;
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index cd438fff7c..dc32317e15 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -64,7 +64,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetrics)
void swap(QFontMetrics &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
int ascent() const;
int capHeight() const;
@@ -136,7 +136,7 @@ public:
QFontMetricsF &operator=(const QFontMetrics &);
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFontMetricsF)
- void swap(QFontMetricsF &other) noexcept { qSwap(d, other.d); }
+ void swap(QFontMetricsF &other) noexcept { d.swap(other.d); }
qreal ascent() const;
qreal capHeight() const;
diff --git a/src/gui/text/qglyphrun.h b/src/gui/text/qglyphrun.h
index 0e9f0ce468..7ea47fdb21 100644
--- a/src/gui/text/qglyphrun.h
+++ b/src/gui/text/qglyphrun.h
@@ -70,7 +70,7 @@ public:
QGlyphRun &operator=(const QGlyphRun &other);
~QGlyphRun();
- void swap(QGlyphRun &other) noexcept { qSwap(d, other.d); }
+ void swap(QGlyphRun &other) noexcept { d.swap(other.d); }
QRawFont rawFont() const;
void setRawFont(const QRawFont &rawFont);
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 51f7ba8044..2e1aaa6da4 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -83,7 +83,7 @@ public:
QRawFont &operator=(const QRawFont &other);
~QRawFont();
- void swap(QRawFont &other) noexcept { qSwap(d, other.d); }
+ void swap(QRawFont &other) noexcept { d.swap(other.d); }
bool isValid() const;
diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h
index 778861ed79..aafc43ed56 100644
--- a/src/gui/text/qstatictext.h
+++ b/src/gui/text/qstatictext.h
@@ -68,7 +68,7 @@ public:
QStaticText &operator=(const QStaticText &);
~QStaticText();
- void swap(QStaticText &other) noexcept { qSwap(data, other.data); }
+ void swap(QStaticText &other) noexcept { data.swap(other.data); }
void setText(const QString &text);
QString text() const;
diff --git a/src/gui/text/qtextcursor.h b/src/gui/text/qtextcursor.h
index 59b32e0874..b33b05aacc 100644
--- a/src/gui/text/qtextcursor.h
+++ b/src/gui/text/qtextcursor.h
@@ -77,7 +77,7 @@ public:
QTextCursor &operator=(const QTextCursor &other);
~QTextCursor();
- void swap(QTextCursor &other) noexcept { qSwap(d, other.d); }
+ void swap(QTextCursor &other) noexcept { d.swap(other.d); }
bool isNull() const;
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index e8ebe75899..91f76e9987 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -320,7 +320,7 @@ public:
~QTextFormat();
void swap(QTextFormat &other)
- { qSwap(d, other.d); qSwap(format_type, other.format_type); }
+ { d.swap(other.d); std::swap(format_type, other.format_type); }
void merge(const QTextFormat &other);