diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-09-02 11:35:18 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-09-02 11:35:18 (GMT) |
commit | 56ef015b1c2384e0590f19e938d349bcffdb6961 (patch) | |
tree | 2fbecb0ca7956fed9b098b9394af43e4f0047f27 | |
parent | 145de5acb68f320125b7566a7d726a5a7786a5f8 (diff) | |
download | Qt-56ef015b1c2384e0590f19e938d349bcffdb6961.zip Qt-56ef015b1c2384e0590f19e938d349bcffdb6961.tar.gz Qt-56ef015b1c2384e0590f19e938d349bcffdb6961.tar.bz2 |
optimize QGlyphRun's operator == a bit
Merge-request: 2652
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
-rw-r--r-- | src/gui/text/qglyphrun.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 3633978..7f43378 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -140,14 +140,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 |