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

Alexander Farrow (via logerrit) logerrit at kemper.freedesktop.org
Tue Apr 9 07:10:44 UTC 2019


 vcl/source/gdi/CommonSalLayout.cxx |    2 +-
 vcl/source/gdi/sallayout.cxx       |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit a39f2e1943c7092dd32bd1f4e480ee6da54a80e4
Author:     Alexander Farrow <alexanderfarrow at tutanota.com>
AuthorDate: Mon Apr 8 18:54:20 2019 +0100
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Apr 9 09:10:22 2019 +0200

    tdf#103322 GlyphItem::m_aLinearPos use getX() instead of X()
    
    GlyphItem::m_aLinearPos is a tools::Point variable.
    Eventually it will be changed to a basegfx::B2DPoint variable - to add support
    for sub pixel glyph positioning.
    
    basegfx::B2DPoint has the getX() method to retrieve a point's X coordinate.
    
    tools::Point has two methods to retrieve a point's X coordinate:
    1. X()
    2. getX()
    Both of these methods return the same value because getX() just calls X().
    So any call to X() can replaced by getX() and vice versa.
    
    By replacing calls to X() with getX() now we won't have to make these changes
    later when we swap from tools::Point to basegfx::B2DPoint.
    
    Change-Id: Idfa0584cb3a7ce246b5499814b7e29f86167d8b8
    Reviewed-on: https://gerrit.libreoffice.org/70436
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index 6187ec6fed5c..872603228508 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -767,7 +767,7 @@ void GenericSalLayout::ApplyDXArray(const ImplLayoutArgs& rArgs)
                     nOverlap = nExcess / (nCopies - 1);
             }
 
-            Point aPos(pGlyphIter->m_aLinearPos.X() - nTotalWidth, 0);
+            Point aPos(pGlyphIter->m_aLinearPos.getX() - nTotalWidth, 0);
             int nCharPos = pGlyphIter->m_nCharPos;
             int const nFlags = GlyphItem::IS_IN_CLUSTER | GlyphItem::IS_RTL_GLYPH;
             while (nCopies--)
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9b665674d999..fc0a765e2af7 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -712,7 +712,7 @@ DeviceCoordinate GenericSalLayout::GetTextWidth() const
     for (auto const& aGlyphItem : *m_GlyphItems.Impl())
     {
         // update the text extent with the glyph extent
-        DeviceCoordinate nXPos = aGlyphItem.m_aLinearPos.X();
+        DeviceCoordinate nXPos = aGlyphItem.m_aLinearPos.getX();
         if( nMinPos > nXPos )
             nMinPos = nXPos;
         nXPos += aGlyphItem.m_nNewWidth - aGlyphItem.m_nXOffset;
@@ -789,14 +789,14 @@ void GenericSalLayout::Justify( DeviceCoordinate nNewWidth )
         {
             for( pGlyphIter = m_GlyphItems.Impl()->begin(); ++pGlyphIter != pGlyphIterRight;)
             {
-                int nX = pGlyphIter->m_aLinearPos.X();
+                int nX = pGlyphIter->m_aLinearPos.getX();
                 nX = static_cast<int>(nX * fSqueeze);
                 pGlyphIter->m_aLinearPos.setX( nX );
             }
         }
         // adjust glyph widths to new positions
         for( pGlyphIter = m_GlyphItems.Impl()->begin(); pGlyphIter != pGlyphIterRight; ++pGlyphIter )
-            pGlyphIter->m_nNewWidth = pGlyphIter[1].m_aLinearPos.X() - pGlyphIter[0].m_aLinearPos.X();
+            pGlyphIter->m_nNewWidth = pGlyphIter[1].m_aLinearPos.getX() - pGlyphIter[0].m_aLinearPos.getX();
     }
 }
 
@@ -850,7 +850,7 @@ void GenericSalLayout::GetCaretPositions( int nMaxIndex, long* pCaretXArray ) co
     // calculate caret positions using glyph array
     for (auto const& aGlyphItem : *m_GlyphItems.Impl())
     {
-        long nXPos = aGlyphItem.m_aLinearPos.X();
+        long nXPos = aGlyphItem.m_aLinearPos.getX();
         long nXRight = nXPos + aGlyphItem.m_nOrigWidth;
         int n = aGlyphItem.m_nCharPos;
         int nCurrIdx = 2 * (n - mnMinCharPos);
@@ -943,7 +943,7 @@ void GenericSalLayout::MoveGlyph( int nStart, long nNewXPos )
     if( pGlyphIter->IsRTLGlyph() )
         nNewXPos += pGlyphIter->m_nNewWidth - pGlyphIter->m_nOrigWidth;
     // calculate the x-offset to the old position
-    long nXDelta = nNewXPos - pGlyphIter->m_aLinearPos.X();
+    long nXDelta = nNewXPos - pGlyphIter->m_aLinearPos.getX();
     // adjust all following glyph positions if needed
     if( nXDelta != 0 )
     {


More information about the Libreoffice-commits mailing list