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>
bb10
Konstantin Ritt 2011-09-02 13:35:18 +02:00 committed by Eskil Abrahamsen Blomfeldt
parent c6bdbf34eb
commit c048e2350b
1 changed files with 11 additions and 7 deletions

View File

@ -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