From c048e2350b790758759995983d84a4fbd7e6db7d Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 2 Sep 2011 13:35:18 +0200 Subject: optimize QGlyphRun's operator == a bit Merge-request: 2652 Reviewed-by: Eskil Abrahamsen Blomfeldt (cherry picked from commit 56ef015b1c2384e0590f19e938d349bcffdb6961) Change-Id: Icc5fd9e8a04518d476e96d5983a95740f454f62a Reviewed-on: http://codereview.qt.nokia.com/4140 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qglyphrun.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/gui/text/qglyphrun.cpp') 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; iglyphIndexDataSize, 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 -- cgit v1.2.3