summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qglyphrun.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/text/qglyphrun.cpp')
-rw-r--r--src/gui/text/qglyphrun.cpp33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp
index be9c058693..90efc4db21 100644
--- a/src/gui/text/qglyphrun.cpp
+++ b/src/gui/text/qglyphrun.cpp
@@ -141,14 +141,18 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const
return false;
}
- for (int i=0; i<qMax(d->glyphIndexDataSize, d->glyphPositionDataSize); ++i) {
- if (i < d->glyphIndexDataSize && d->glyphIndexData[i] != other.d->glyphIndexData[i])
- return false;
-
- if (i < d->glyphPositionDataSize && d->glyphPositionData[i] != other.d->glyphPositionData[i])
- return false;
+ if (d->glyphIndexData != other.d->glyphIndexData) {
+ for (int i = 0; i < d->glyphIndexDataSize; ++i) {
+ if (d->glyphIndexData[i] != other.d->glyphIndexData[i])
+ return false;
+ }
+ }
+ if (d->glyphPositionData != other.d->glyphPositionData) {
+ for (int i = 0; i < d->glyphPositionDataSize; ++i) {
+ if (d->glyphPositionData[i] != other.d->glyphPositionData[i])
+ return false;
+ }
}
-
return (d->overline == other.d->overline
&& d->underline == other.d->underline
@@ -157,13 +161,11 @@ bool QGlyphRun::operator==(const QGlyphRun &other) const
}
/*!
+ \fn bool QGlyphRun::operator!=(const QGlyphRun &other) const
+
Compares \a other to this QGlyphRun object. Returns true if any of the list of glyph
indexes, the list of positions or the font are different, otherwise returns false.
*/
-bool QGlyphRun::operator!=(const QGlyphRun &other) const
-{
- return !(*this == other);
-}
/*!
Returns the font selected for this QGlyphRun object.
@@ -295,6 +297,9 @@ bool QGlyphRun::overline() const
*/
void QGlyphRun::setOverline(bool overline)
{
+ if (d->overline == overline)
+ return;
+
detach();
d->overline = overline;
}
@@ -317,6 +322,9 @@ bool QGlyphRun::underline() const
*/
void QGlyphRun::setUnderline(bool underline)
{
+ if (d->underline == underline)
+ return;
+
detach();
d->underline = underline;
}
@@ -339,6 +347,9 @@ bool QGlyphRun::strikeOut() const
*/
void QGlyphRun::setStrikeOut(bool strikeOut)
{
+ if (d->strikeOut == strikeOut)
+ return;
+
detach();
d->strikeOut = strikeOut;
}