diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2011-09-02 13:35:18 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2011-09-02 13:39:19 +0200 |
commit | c048e2350b790758759995983d84a4fbd7e6db7d (patch) | |
tree | 7eaf070d79e3514d2c98e04202cb25f7a36c456a /src/gui/text/qglyphrun.cpp | |
parent | c6bdbf34ebe88426036efd6cb373572425b53482 (diff) |
optimize QGlyphRun's operator == a bit
Merge-request: 2652
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
(cherry picked from commit 56ef015b1c2384e0590f19e938d349bcffdb6961)
Change-Id: Icc5fd9e8a04518d476e96d5983a95740f454f62a
Reviewed-on: http://codereview.qt.nokia.com/4140
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
Diffstat (limited to 'src/gui/text/qglyphrun.cpp')
-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 8a002ab0ac..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 |