summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthieabaud@gmail.com>2015-03-28 20:38:22 -0500
committerNorbert Thiebaud <nthieabaud@gmail.com>2015-03-28 20:38:22 -0500
commit3c6fd5a59b08cec8705a31d17a60204acf6b7173 (patch)
tree9c98cc5549f08082045f8d80f5c95cc4f99e0d03 /sw
parent9eeee5466fba5a3ff1de6d47b6341d83cf14c275 (diff)
Revert "tdf#89666: vcl: speed up HbLayoutEngine with cache in SwTxtFormatInfo"
This reverts commit 1efe5fe38031f7bc23150c35e4c68940621a1d5b. which broke windows.
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/inc/drawfont.hxx16
-rw-r--r--sw/source/core/text/guess.cxx7
-rw-r--r--sw/source/core/text/inftxt.cxx35
-rw-r--r--sw/source/core/text/inftxt.hxx25
-rw-r--r--sw/source/core/text/porfld.cxx4
-rw-r--r--sw/source/core/text/pormulti.cxx3
-rw-r--r--sw/source/core/txtnode/fntcache.cxx7
7 files changed, 18 insertions, 79 deletions
diff --git a/sw/source/core/inc/drawfont.hxx b/sw/source/core/inc/drawfont.hxx
index fee34b12737e..033d4901b263 100644
--- a/sw/source/core/inc/drawfont.hxx
+++ b/sw/source/core/inc/drawfont.hxx
@@ -31,10 +31,7 @@ class Point;
class SwWrongList;
class Size;
class SwFont;
-namespace vcl {
- class Font;
- class TextLayoutCache;
-}
+namespace vcl { class Font; }
class SwUnderlineFont;
// encapsulates information for drawing text
@@ -45,7 +42,6 @@ class SwDrawTextInfo
SwViewShell const * pSh;
const SwScriptInfo* pScriptInfo;
Point m_aPos;
- vcl::TextLayoutCache const* m_pCachedVclData;
OUString m_aText;
const SwWrongList* pWrong;
const SwWrongList* pGrammarCheck;
@@ -108,9 +104,7 @@ public:
SwDrawTextInfo( SwViewShell const *pS, OutputDevice &rO, const SwScriptInfo* pSI,
const OUString &rSt, sal_Int32 nI, sal_Int32 nL,
- sal_uInt16 nW = 0, bool bB = false,
- vcl::TextLayoutCache const*const pCachedVclData = nullptr)
- : m_pCachedVclData(pCachedVclData)
+ sal_uInt16 nW = 0, bool bB = false )
{
pFrm = NULL;
pSh = pS;
@@ -206,11 +200,6 @@ public:
return pHyphPos;
}
- vcl::TextLayoutCache const* GetVclCache() const
- {
- return m_pCachedVclData;
- }
-
const OUString &GetText() const
{
return m_aText;
@@ -427,7 +416,6 @@ public:
void SetText( const OUString &rNew )
{
m_aText = rNew;
- m_pCachedVclData = nullptr; // would any case benefit from save/restore?
}
void SetWrong( const SwWrongList* pNew )
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index b379308e59b0..03396469609b 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -152,14 +152,14 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
// considering an additional "-" for hyphenation
if( bHyph )
{
- nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp, nHyphPos, rInf.GetCachedVclData().get() );
+ nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp, nHyphPos );
if ( !nHyphPos && rInf.GetIdx() )
nHyphPos = rInf.GetIdx() - 1;
}
else
{
- nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp, rInf.GetCachedVclData().get() );
+ nCutPos = rInf.GetTxtBreak( nLineWidth, nMaxLen, nMaxComp );
#if OSL_DEBUG_LEVEL > 1
if ( COMPLETE_STRING != nCutPos )
@@ -504,8 +504,7 @@ bool SwTxtGuess::Guess( const SwTxtPortion& rPor, SwTxtFormatInfo &rInf,
if( nPorLen )
{
rInf.GetTxtSize( &rSI, rInf.GetIdx(), nPorLen,
- nMaxComp, nBreakWidth, nMaxSizeDiff,
- rInf.GetCachedVclData().get() );
+ nMaxComp, nBreakWidth, nMaxSizeDiff );
// save maximum width for later use
if ( nMaxSizeDiff )
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index b738d9f5e17f..6a622e44352d 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -21,7 +21,6 @@
#include <unotools/linguprops.hxx>
#include <unotools/lingucfg.hxx>
#include <hintids.hxx>
-#include <svl/ctloptions.hxx>
#include <sfx2/printer.hxx>
#include <editeng/hyphenzoneitem.hxx>
#include <editeng/escapementitem.hxx>
@@ -361,7 +360,7 @@ SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
const OUString& rTxt,
const sal_Int32 nIndex,
const sal_Int32 nLength,
- const sal_uInt16 nComp) const
+ const sal_uInt16 nComp ) const
{
SwDrawTextInfo aDrawInf( m_pVsh, *pOutDev, pSI, rTxt, nIndex, nLength );
aDrawInf.SetFrm( m_pFrm );
@@ -394,11 +393,9 @@ SwPosSize SwTxtSizeInfo::GetTxtSize() const
void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIndex,
const sal_Int32 nLength, const sal_uInt16 nComp,
- sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff,
- vcl::TextLayoutCache const*const pCache) const
+ sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const
{
- SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, pSI, *m_pTxt, nIndex, nLength,
- 0, false, pCache);
+ SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, pSI, *m_pTxt, nIndex, nLength );
aDrawInf.SetFrm( m_pFrm );
aDrawInf.SetFont( m_pFnt );
aDrawInf.SetSnapToGrid( SnapToGrid() );
@@ -410,15 +407,14 @@ void SwTxtSizeInfo::GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIndex,
sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
const sal_Int32 nMaxLen,
- const sal_uInt16 nComp,
- vcl::TextLayoutCache const*const pCache) const
+ const sal_uInt16 nComp ) const
{
const SwScriptInfo& rScriptInfo =
const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
OSL_ENSURE( m_pRef == m_pOut, "GetTxtBreak is supposed to use the RefDev" );
SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
- *m_pTxt, GetIdx(), nMaxLen, 0, false, pCache );
+ *m_pTxt, GetIdx(), nMaxLen );
aDrawInf.SetFrm( m_pFrm );
aDrawInf.SetFont( m_pFnt );
aDrawInf.SetSnapToGrid( SnapToGrid() );
@@ -431,15 +427,14 @@ sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
const sal_Int32 nMaxLen,
const sal_uInt16 nComp,
- sal_Int32& rExtraCharPos,
- vcl::TextLayoutCache const*const pCache) const
+ sal_Int32& rExtraCharPos ) const
{
const SwScriptInfo& rScriptInfo =
const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
OSL_ENSURE( m_pRef == m_pOut, "GetTxtBreak is supposed to use the RefDev" );
SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
- *m_pTxt, GetIdx(), nMaxLen, 0, false, pCache );
+ *m_pTxt, GetIdx(), nMaxLen );
aDrawInf.SetFrm( m_pFrm );
aDrawInf.SetFont( m_pFnt );
aDrawInf.SetSnapToGrid( SnapToGrid() );
@@ -1344,19 +1339,6 @@ void SwTxtFormatInfo::CtorInitTxtFormatInfo( SwTxtFrm *pNewFrm, const bool bNewI
nLineHeight = 0;
nLineNetHeight = 0;
SetLineStart(0);
-
- SvtCTLOptions::TextNumerals const nTextNumerals(
- SW_MOD()->GetCTLOptions().GetCTLTextNumerals());
- // cannot cache for NUMERALS_CONTEXT because we need to know the string
- // for the whole paragraph now
- if (nTextNumerals != SvtCTLOptions::NUMERALS_CONTEXT)
- {
- // set digit mode to what will be used later to get same results
- SwDigitModeModifier const m(*m_pRef, LANGUAGE_NONE /*dummy*/);
- assert(m_pRef->GetDigitLanguage() != LANGUAGE_NONE);
- SetCachedVclData(m_pRef->CreateTextLayoutCache(*m_pTxt));
- }
-
Init();
}
@@ -1660,11 +1642,9 @@ SwTxtSlot::SwTxtSlot(
nIdx = pInf->GetIdx();
nLen = pInf->GetLen();
pOldTxt = &(pInf->GetTxt());
- m_pOldCachedVclData = pInf->GetCachedVclData();
pInf->SetTxt( aTxt );
pInf->SetIdx( 0 );
pInf->SetLen( bTxtLen ? pInf->GetTxt().getLength() : pPor->GetLen() );
- pInf->SetCachedVclData(nullptr);
// ST2
if ( bExgLists )
@@ -1709,7 +1689,6 @@ SwTxtSlot::~SwTxtSlot()
{
if( bOn )
{
- pInf->SetCachedVclData(m_pOldCachedVclData);
pInf->SetTxt( *pOldTxt );
pInf->SetIdx( nIdx );
pInf->SetLen( nLen );
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 45680164e43a..a0b627c2bf48 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -158,11 +158,6 @@ protected:
OutputDevice* m_pOut;
OutputDevice* m_pRef;
- // performance hack - this is only used by SwTxtFormatInfo but
- // because it's not even possible to dynamic_cast these things
- // currently it has to be stored here
- std::shared_ptr<vcl::TextLayoutCache> m_pCachedVclData;
-
SwFont *m_pFnt;
SwUnderlineFont *m_pUnderFnt; // Font for underlining
SwTxtFrm *m_pFrm;
@@ -300,21 +295,18 @@ public:
SwPosSize GetTxtSize() const;
void GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIdx,
const sal_Int32 nLen, const sal_uInt16 nComp,
- sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff,
- vcl::TextLayoutCache const* = nullptr) const;
+ sal_uInt16& nMinSize, sal_uInt16& nMaxSizeDiff ) const;
inline SwPosSize GetTxtSize( const SwScriptInfo* pSI, const sal_Int32 nIdx,
const sal_Int32 nLen, const sal_uInt16 nComp ) const;
inline SwPosSize GetTxtSize( const OUString &rTxt ) const;
sal_Int32 GetTxtBreak( const long nLineWidth,
const sal_Int32 nMaxLen,
- const sal_uInt16 nComp,
- vcl::TextLayoutCache const* = nullptr) const;
+ const sal_uInt16 nComp ) const;
sal_Int32 GetTxtBreak( const long nLineWidth,
const sal_Int32 nMaxLen,
const sal_uInt16 nComp,
- sal_Int32& rExtraCharPos,
- vcl::TextLayoutCache const* = nullptr) const;
+ sal_Int32& rExtraCharPos ) const;
sal_uInt16 GetAscent() const;
@@ -379,15 +371,6 @@ public:
{ return ( m_pKanaComp && m_nKanaIdx < m_pKanaComp->size() )
? (*m_pKanaComp)[m_nKanaIdx] : 0; }
- std::shared_ptr<vcl::TextLayoutCache> GetCachedVclData() const
- {
- return m_pCachedVclData;
- }
- void SetCachedVclData(std::shared_ptr<vcl::TextLayoutCache> const& pCachedVclData)
- {
- m_pCachedVclData = pCachedVclData;
- }
-
#ifdef DBG_UTIL
bool IsOptDbg() const;
#endif
@@ -742,7 +725,6 @@ public:
inline void SetTabOverflow( bool bOverflow ) { bTabOverflow = bOverflow; }
inline bool IsTabOverflow() { return bTabOverflow; }
-
};
/**
@@ -755,7 +737,6 @@ public:
class SwTxtSlot
{
OUString aTxt;
- std::shared_ptr<vcl::TextLayoutCache> m_pOldCachedVclData;
const OUString *pOldTxt;
const SwWrongList* pOldSmartTagList;
const SwWrongList* pOldGrammarCheckList;
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 95b1542fe8cc..ae446176bf96 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -136,7 +136,6 @@ sal_uInt16 SwFldPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
*/
class SwFldSlot
{
- std::shared_ptr<vcl::TextLayoutCache> m_pOldCachedVclData;
const OUString *pOldTxt;
OUString aTxt;
sal_Int32 nIdx;
@@ -163,9 +162,7 @@ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor )
nIdx = pInf->GetIdx();
nLen = pInf->GetLen();
pOldTxt = &(pInf->GetTxt());
- m_pOldCachedVclData = pInf->GetCachedVclData();
pInf->SetLen( aTxt.getLength() );
- pInf->SetCachedVclData(nullptr);
if( pPor->IsFollow() )
{
pInf->SetFakeLineStart( nIdx > pInf->GetLineStart() );
@@ -183,7 +180,6 @@ SwFldSlot::~SwFldSlot()
{
if( bOn )
{
- pInf->SetCachedVclData(m_pOldCachedVclData);
pInf->SetTxt( *pOldTxt );
pInf->SetIdx( nIdx );
pInf->SetLen( nLen );
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 2bb8217403fa..9df8de427167 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -1735,8 +1735,6 @@ bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
// save some values
const OUString* pOldTxt = &(rInf.GetTxt());
const SwTwips nOldPaintOfst = rInf.GetPaintOfst();
- std::shared_ptr<vcl::TextLayoutCache> const pOldCachedVclData(rInf.GetCachedVclData());
- rInf.SetCachedVclData(nullptr);
OUString const aMultiStr( rInf.GetTxt().copy(0, nMultiLen + rInf.GetIdx()) );
rInf.SetTxt( aMultiStr );
@@ -2055,7 +2053,6 @@ bool SwTxtFormatter::BuildMultiPortion( SwTxtFormatInfo &rInf,
rInf.SetRest( pTmp );
}
- rInf.SetCachedVclData(pOldCachedVclData);
rInf.SetTxt( *pOldTxt );
rInf.SetPaintOfst( nOldPaintOfst );
rInf.SetStop( aInf.IsStop() );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 05230811b4dc..225e637bcaf4 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -1973,8 +1973,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
else
{
aTxtSize.Width() = rInf.GetOut().GetTextWidth( rInf.GetText(),
- rInf.GetIdx(), nLn,
- rInf.GetVclCache());
+ rInf.GetIdx(), nLn );
rInf.SetKanaDiff( 0 );
}
@@ -2431,12 +2430,12 @@ sal_Int32 SwFont::GetTxtBreak( SwDrawTextInfo& rInf, long nTextWidth )
sal_Int32 nHyphPos = *rInf.GetHyphPos();
nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
static_cast<sal_Unicode>('-'), nHyphPos,
- nTmpIdx, nTmpLen, nKern, rInf.GetVclCache());
+ nTmpIdx, nTmpLen, nKern );
*rInf.GetHyphPos() = (nHyphPos == -1) ? COMPLETE_STRING : nHyphPos;
}
else
nTxtBreak = rInf.GetOut().GetTextBreak( *pTmpText, nTextWidth,
- nTmpIdx, nTmpLen, nKern, rInf.GetVclCache());
+ nTmpIdx, nTmpLen, nKern );
if ( bTextReplaced && nTxtBreak != -1 )
{