summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-16 17:34:49 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-08-16 23:39:04 +0200
commitc5dc042219e9872937f9fe1cb68f2f03423f398e (patch)
tree422d1bd4981541c086f6d1dcb4de214a7792a47a /vcl/source/window
parent24a30e5bde07cf168c30adadb417ba002818970b (diff)
vcl: use SalLayoutGlyphs, not SalLayout for pre-computed layout
This means that the pre-computed glyph ids and positions are usable with multiple dx array or draw base. So the amount of cached data is smaller, but it can be used in more situations, most importantly Writer's SwFntObj::DrawText() use-case (which does GetTextArray() followed by a DrawTextArray(), with different dx array arguments). Change-Id: I3bcd1b7a015c2cf9921efa0f3f355f2c627fb652 Reviewed-on: https://gerrit.libreoffice.org/59207 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/status.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index 4a9d24bd4f7e..666824613b34 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -408,7 +408,8 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
pLayoutCache = pItem->mxLayoutCache.get();
}
- Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pLayoutCache), rRenderContext.GetTextHeight());
+ const SalLayoutGlyphs* pGlyphs = pLayoutCache ? pLayoutCache->GetGlyphs() : nullptr;
+ Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pGlyphs), rRenderContext.GetTextHeight());
Point aTextPos = ImplGetItemTextPos(aTextRectSize, aTextSize, pItem->mnBits);
@@ -418,7 +419,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
aTextPos,
pItem->maText,
0, -1, nullptr, nullptr,
- pLayoutCache );
+ pGlyphs );
}
else
{
@@ -428,7 +429,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
aTextPos,
pItem->maText,
0, -1, nullptr, nullptr,
- pLayoutCache );
+ pGlyphs );
}
// call DrawItem if necessary
@@ -1192,7 +1193,8 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
long nFudge = GetTextHeight()/4;
std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1);
- long nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout.get() ) + nFudge;
+ const SalLayoutGlyphs* pGlyphs = pSalLayout ? pSalLayout->GetGlyphs() : nullptr;
+ long nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pGlyphs ) + nFudge;
// Store the calculated layout.
pItem->mxLayoutCache = std::move(pSalLayout);