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

Michael Stahl mstahl at redhat.com
Fri Jan 22 05:27:55 PST 2016


 vcl/quartz/ctlayout.cxx |   35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

New commits:
commit 9e519ebf8737c8455b8286aa8abaa8a9c683a04d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Wed Jan 20 11:38:42 2016 +0100

    vcl: replace boost::ptr_vector with std::vector<std::unique_ptr>
    
    Change-Id: Ia5e5349e879d46d6a57b7b83b31346766c11c58b
    Reviewed-on: https://gerrit.libreoffice.org/21662
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/vcl/quartz/ctlayout.cxx b/vcl/quartz/ctlayout.cxx
index 2b0eedb..6bdcad3 100644
--- a/vcl/quartz/ctlayout.cxx
+++ b/vcl/quartz/ctlayout.cxx
@@ -19,7 +19,8 @@
 
 #include <sal/config.h>
 
-#include <boost/ptr_container/ptr_vector.hpp>
+#include <memory>
+#include <vector>
 
 #include <sal/types.h>
 #include <tools/debug.hxx>
@@ -79,7 +80,7 @@ private:
     mutable double  mfBaseAdv;
 
     mutable bool  bLayouted; // true if the glyph layout information are cached and current;
-    mutable boost::ptr_vector<CTRunData> m_vRunData;
+    mutable std::vector<std::unique_ptr<CTRunData>> m_vRunData;
 
 };
 
@@ -109,7 +110,7 @@ CTLayout::~CTLayout()
 
 bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
 {
-    m_vRunData.release();
+    m_vRunData.clear();
     bLayouted = false;
 
     // release an eventual older layout
@@ -452,7 +453,7 @@ void CTLayout::DrawText( SalGraphics& rGraphics ) const
 
 bool CTLayout::CacheGlyphLayout() const // eew!
 {
-    m_vRunData.release();
+    m_vRunData.clear();
     if(!mpCTLine)
     {
         return false;
@@ -465,7 +466,7 @@ bool CTLayout::CacheGlyphLayout() const // eew!
     {
         CTRunRef pRun = static_cast<CTRunRef>(CFArrayGetValueAtIndex( aRuns, i ));
         CTRunData* pRunData = new CTRunData(pRun, nPos);
-        m_vRunData.push_back(pRunData);
+        m_vRunData.push_back(std::unique_ptr<CTRunData>(pRunData));
         nPos += pRunData->m_nGlyphs;
     }
     bLayouted = true;
@@ -494,9 +495,9 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
     CTFontDescriptorRef pFontDesc = nullptr;
     FontAttributes rDevFontAttr;
 
-    boost::ptr_vector<CTRunData>::const_iterator iter = m_vRunData.begin();
+    auto iter = m_vRunData.begin();
 
-    while(iter != m_vRunData.end() && iter->m_EndPos <= nStart)
+    while (iter != m_vRunData.end() && (*iter)->m_EndPos <= nStart)
     {
         ++iter;
     }
@@ -509,7 +510,7 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
         if( pFallbackFonts )
         {
             pFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName ));
-            pFontDesc = CTFontCopyFontDescriptor( iter->m_pFont );
+            pFontDesc = CTFontCopyFontDescriptor( (*iter)->m_pFont );
             rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, nullptr );
         }
     }
@@ -518,19 +519,19 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
     while( i < nStart + nLen )
     {
             // convert glyph details for VCL
-        int j = i - iter->m_StartPos;
-        *(pOutGlyphIds++) = iter->m_pGlyphs[ j ];
+        int j = i - (*iter)->m_StartPos;
+        *(pOutGlyphIds++) = (*iter)->m_pGlyphs[ j ];
         if( pGlyphAdvances )
         {
-            *(pGlyphAdvances++) = lrint(iter->m_pAdvances[ j ].width);
+            *(pGlyphAdvances++) = lrint((*iter)->m_pAdvances[ j ].width);
         }
         if( pCharIndexes )
         {
-            *(pCharIndexes++) = iter->m_pStringIndices[ j ] + mnMinCharPos;
+            *(pCharIndexes++) = (*iter)->m_pStringIndices[ j ] + mnMinCharPos;
         }
         if( pFallbackFonts )
         {
-            if ( !CFEqual( iter->m_pFont,  pFont ) )
+            if (!CFEqual((*iter)->m_pFont,  pFont))
             {
                 pFallbackFont = new CoreTextFontFace( rDevFontAttr, reinterpret_cast<sal_IntPtr>(pFontDesc) );
                 *(pFallbackFonts++) = pFallbackFont;
@@ -542,23 +543,23 @@ int CTLayout::GetNextGlyphs( int nLen, sal_GlyphId* pOutGlyphIds, Point& rPos, i
         }
         if( i == nStart )
         {
-            const CGPoint& rFirstPos = iter->m_pPositions[ j ];
+            const CGPoint& rFirstPos = (*iter)->m_pPositions[ j ];
             rPos = GetDrawPosition( Point( rFirstPos.x, rFirstPos.y) );
         }
         i += 1;
         count += 1;
-        if(i == iter->m_EndPos)
+        if (i == (*iter)->m_EndPos)
         {
             // note: we assume that we do not have empty runs in the middle of things
             ++iter;
-            if( iter == m_vRunData.end())
+            if (iter == m_vRunData.end())
             {
                 break;
             }
             if( pFallbackFonts )
             {
                 pFont = static_cast<CTFontRef>(CFDictionaryGetValue( mpTextStyle->GetStyleDict(), kCTFontAttributeName ));
-                pFontDesc = CTFontCopyFontDescriptor( iter->m_pFont );
+                pFontDesc = CTFontCopyFontDescriptor( (*iter)->m_pFont );
                 rDevFontAttr = DevFontFromCTFontDescriptor( pFontDesc, nullptr );
             }
         }


More information about the Libreoffice-commits mailing list