[Libreoffice-commits] core.git: Branch 'libreoffice-4-4-3' - vcl/source

Michael Stahl mstahl at redhat.com
Tue Apr 21 09:01:16 PDT 2015


 vcl/source/outdev/text.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 0070b8f540e6b6fbecd5f1793b9d338de4841868
Author: Michael Stahl <mstahl at redhat.com>
Date:   Thu Apr 16 22:25:23 2015 +0200

    tdf#86793: vcl: speed up OutputDevice::GetEllipsisString()
    
    The ridiculous algrorithm used for TEXT_DRAW_CENTERELLIPSIS will go faster
    if we cut out most of the text at the beginning instead of one at a time.
    
    (regression from 912ecaf565e68d2ca3fb9584712313e712749f75)
    
    (cherry picked from commit c6ec3e4cee8c7c22380780f2661ac23946cdb050)
    
    Change-Id: I9310dda1847222215bafe372e3efef9d365e1ad9
    Reviewed-on: https://gerrit.libreoffice.org/15355
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 84b28b7d0b5061377b368c809acdb286902b4069)
    Reviewed-on: https://gerrit.libreoffice.org/15426
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 113a42e..8c066d1 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -1993,7 +1993,8 @@ OUString OutputDevice::ImplGetEllipsisString( const OutputDevice& rTargetDevice,
         if( (nStyle & TEXT_DRAW_CENTERELLIPSIS) == TEXT_DRAW_CENTERELLIPSIS )
         {
             OUStringBuffer aTmpStr( aStr );
-            sal_Int32 nEraseChars = 4;
+            // speed it up by removing all but 1.33x as many as the break pos.
+            sal_Int32 nEraseChars = std::max<sal_Int32>(4, aStr.getLength() - (nIndex*4)/3);
             while( nEraseChars < aStr.getLength() && _rLayout.GetTextWidth( aTmpStr.toString(), 0, aTmpStr.getLength() ) > nMaxWidth )
             {
                 aTmpStr = OUStringBuffer(aStr);


More information about the Libreoffice-commits mailing list