[Libreoffice-commits] core.git: vcl/source

Khaled Hosny khaledhosny at eglug.org
Mon Nov 28 08:40:04 UTC 2016


 vcl/source/gdi/sallayout.cxx |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 265c953584f8a1e3a832dd92dc2198056438b418
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Mon Nov 28 08:03:02 2016 +0200

    Use range for loop
    
    Change-Id: I28cfa9864d9596868cdf1349c210342d9c2b6329
    Reviewed-on: https://gerrit.libreoffice.org/31302
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9c10cde..bba21ab 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -805,13 +805,13 @@ DeviceCoordinate GenericSalLayout::GetTextWidth() const
     DeviceCoordinate nMinPos = 0;
     DeviceCoordinate nMaxPos = 0;
 
-    for( std::vector<GlyphItem>::const_iterator pGlyphIter = m_GlyphItems.begin(), end = m_GlyphItems.end(); pGlyphIter != end ; ++pGlyphIter )
+    for (auto const& aGlyphItem : m_GlyphItems)
     {
         // update the text extent with the glyph extent
-        DeviceCoordinate nXPos = pGlyphIter->maLinearPos.X();
+        DeviceCoordinate nXPos = aGlyphItem.maLinearPos.X();
         if( nMinPos > nXPos )
             nMinPos = nXPos;
-        nXPos += pGlyphIter->mnNewWidth - pGlyphIter->mnXOffset;
+        nXPos += aGlyphItem.mnNewWidth - aGlyphItem.mnXOffset;
         if( nMaxPos < nXPos )
             nMaxPos = nXPos;
     }
@@ -944,16 +944,16 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) co
         pCaretXArray[i] = -1;
 
     // calculate caret positions using glyph array
-    for( std::vector<GlyphItem>::const_iterator pGlyphIter = m_GlyphItems.begin(), pGlyphIterEnd = m_GlyphItems.end(); pGlyphIter != pGlyphIterEnd; ++pGlyphIter )
+    for (auto const& aGlyphItem : m_GlyphItems)
     {
-        long nXPos = pGlyphIter->maLinearPos.X();
-        long nXRight = nXPos + pGlyphIter->mnOrigWidth;
-        int n = pGlyphIter->mnCharPos;
+        long nXPos = aGlyphItem.maLinearPos.X();
+        long nXRight = nXPos + aGlyphItem.mnOrigWidth;
+        int n = aGlyphItem.mnCharPos;
         int nCurrIdx = 2 * (n - mnMinCharPos);
         // tdf#86399 if this is not the start of a cluster, don't overwrite the caret bounds of the cluster start
-        if (!pGlyphIter->IsClusterStart() && pCaretXArray[nCurrIdx] != -1)
+        if (!aGlyphItem.IsClusterStart() && pCaretXArray[nCurrIdx] != -1)
             continue;
-        if( !pGlyphIter->IsRTLGlyph() )
+        if (!aGlyphItem.IsRTLGlyph() )
         {
             // normal positions for LTR case
             pCaretXArray[ nCurrIdx ]   = nXPos;


More information about the Libreoffice-commits mailing list