summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-03-22 18:18:56 +0100
committerLuboš Luňák <l.lunak@collabora.com>2021-03-23 13:42:45 +0100
commita8c23e5e5bd36899320c93d22040a093fe7a6c04 (patch)
treeb6617d06cac14ca3e4eac6b235aa3e34f0e5c7c0
parent24552a0b5be620b5e58b10842cba78e36fa26b04 (diff)
do not use invalid SalLayoutGlyphs
It triggers a warning in ImplLayout(), which technically could be downgraded to SAL_INFO, but I think it's better to keep it there to catch possible mistakes. Change-Id: I2ab0a0cf49fc07a4e23f3ec57e7375723a20b669 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112935 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--vcl/source/window/status.cxx11
1 files changed, 6 insertions, 5 deletions
diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx
index e3c193609bd3..e46147e1a87a 100644
--- a/vcl/source/window/status.cxx
+++ b/vcl/source/window/status.cxx
@@ -399,7 +399,8 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
}
const SalLayoutGlyphs glyphs = pLayoutCache ? pLayoutCache->GetGlyphs() : SalLayoutGlyphs();
- Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,&glyphs), rRenderContext.GetTextHeight());
+ const SalLayoutGlyphs* pGlyphs = pLayoutCache ? &glyphs : nullptr;
+ Size aTextSize(rRenderContext.GetTextWidth(pItem->maText,0,-1,nullptr,pGlyphs), rRenderContext.GetTextHeight());
Point aTextPos = ImplGetItemTextPos(aTextRectSize, aTextSize, pItem->mnBits);
if (bOffScreen)
@@ -408,7 +409,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
aTextPos,
pItem->maText,
0, -1, nullptr, nullptr,
- &glyphs );
+ pGlyphs );
}
else
{
@@ -418,7 +419,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen
aTextPos,
pItem->maText,
0, -1, nullptr, nullptr,
- &glyphs );
+ pGlyphs );
}
}
@@ -1140,14 +1141,14 @@ void StatusBar::SetItemText( sal_uInt16 nItemId, const OUString& rText, int nCha
{
std::unique_ptr<SalLayout> pSalLayout = ImplLayout("0",0,-1);
const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs();
- nWidth = GetTextWidth("0",0,-1,nullptr,&glyphs);
+ nWidth = GetTextWidth("0",0,-1,nullptr,pSalLayout ? &glyphs : nullptr);
nWidth = nWidth * nCharsWidth + nFudge;
}
else
{
std::unique_ptr<SalLayout> pSalLayout = ImplLayout(pItem->maText,0,-1);
const SalLayoutGlyphs glyphs = pSalLayout ? pSalLayout->GetGlyphs() : SalLayoutGlyphs();
- nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,&glyphs) + nFudge;
+ nWidth = GetTextWidth( pItem->maText,0,-1,nullptr,pSalLayout ? &glyphs : nullptr) + nFudge;
// Store the calculated layout.
pItem->mxLayoutCache = std::move(pSalLayout);
}