Kaydet (Commit) 2a73c9e0 authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: less vcl text layout calls in SwFont::GetTextBreak()

Number of GenericSalLayout::LayoutText() calls during "dt<F3>" in Writer: 105
-> 89.

Change-Id: I0f2bb241536209cfccc1d78bed6f54bf5c31e627
Reviewed-on: https://gerrit.libreoffice.org/60133Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins
üst 2aaf5a73
...@@ -1174,7 +1174,8 @@ public: ...@@ -1174,7 +1174,8 @@ public:
sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen = -1, sal_Int32 nIndex, sal_Int32 nLen = -1,
long nCharExtra = 0, long nCharExtra = 0,
vcl::TextLayoutCache const* = nullptr) const; vcl::TextLayoutCache const* = nullptr,
const SalLayoutGlyphs* pGlyphs = nullptr) const;
sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Unicode nExtraChar, sal_Int32& rExtraCharPos, sal_Unicode nExtraChar, sal_Int32& rExtraCharPos,
sal_Int32 nIndex, sal_Int32 nLen, sal_Int32 nIndex, sal_Int32 nLen,
......
...@@ -122,6 +122,7 @@ public: ...@@ -122,6 +122,7 @@ public:
sal_uInt16 GetZoom() const { return m_nZoom; } sal_uInt16 GetZoom() const { return m_nZoom; }
sal_uInt16 GetPropWidth() const { return m_nPropWidth; } sal_uInt16 GetPropWidth() const { return m_nPropWidth; }
bool IsSymbol() const { return m_bSymbol; } bool IsSymbol() const { return m_bSymbol; }
std::map<SwTextGlyphsKey, SalLayoutGlyphs>& GetTextGlyphs() { return m_aTextGlyphs; }
void DrawText( SwDrawTextInfo &rInf ); void DrawText( SwDrawTextInfo &rInf );
/// determine the TextSize (of the printer) /// determine the TextSize (of the printer)
......
...@@ -2483,10 +2483,17 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth ...@@ -2483,10 +2483,17 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth
*rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? COMPLETE_STRING : nHyphPos); *rInf.GetHyphPos() = TextFrameIndex((nHyphPos == -1) ? COMPLETE_STRING : nHyphPos);
} }
else else
{
SwFntAccess aFntAccess(m_aSub[m_nActual].m_nFontCacheId, m_aSub[m_nActual].m_nFontIndex,
&m_aSub[m_nActual], rInf.GetShell());
SwTextGlyphsKey aGlyphsKey{ &rInf.GetOut(), *pTmpText, nTmpIdx, nTmpLen };
SalLayoutGlyphs* pGlyphs
= lcl_CreateLayout(aGlyphsKey, aFntAccess.Get()->GetTextGlyphs()[aGlyphsKey]);
nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak( nTextBreak = TextFrameIndex(rInf.GetOut().GetTextBreak(
*pTmpText, nTextWidth, *pTmpText, nTextWidth,
sal_Int32(nTmpIdx), sal_Int32(nTmpLen), sal_Int32(nTmpIdx), sal_Int32(nTmpLen),
nKern, rInf.GetVclCache())); nKern, rInf.GetVclCache(), pGlyphs));
}
if (bTextReplaced && sal_Int32(nTextBreak) != -1) if (bTextReplaced && sal_Int32(nTextBreak) != -1)
{ {
......
...@@ -1394,10 +1394,11 @@ bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, sal_ ...@@ -1394,10 +1394,11 @@ bool OutputDevice::GetTextIsRTL( const OUString& rString, sal_Int32 nIndex, sal_
sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth, sal_Int32 OutputDevice::GetTextBreak( const OUString& rStr, long nTextWidth,
sal_Int32 nIndex, sal_Int32 nLen, sal_Int32 nIndex, sal_Int32 nLen,
long nCharExtra, long nCharExtra,
vcl::TextLayoutCache const*const pLayoutCache) const vcl::TextLayoutCache const*const pLayoutCache,
const SalLayoutGlyphs* pGlyphs) const
{ {
std::unique_ptr<SalLayout> pSalLayout = ImplLayout( rStr, nIndex, nLen, std::unique_ptr<SalLayout> pSalLayout = ImplLayout( rStr, nIndex, nLen,
Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache); Point(0,0), 0, nullptr, SalLayoutFlags::NONE, pLayoutCache, pGlyphs);
sal_Int32 nRetVal = -1; sal_Int32 nRetVal = -1;
if( pSalLayout ) if( pSalLayout )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment