[Libreoffice-commits] core.git: vcl/source
LuboÅ¡ LuÅák (via logerrit)
logerrit at kemper.freedesktop.org
Tue Mar 23 12:43:25 UTC 2021
vcl/source/window/status.cxx | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
New commits:
commit a8c23e5e5bd36899320c93d22040a093fe7a6c04
Author: Luboš Luňák <l.lunak at collabora.com>
AuthorDate: Mon Mar 22 18:18:56 2021 +0100
Commit: Luboš Luňák <l.lunak at collabora.com>
CommitDate: Tue Mar 23 13:42:45 2021 +0100
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 at collabora.com>
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);
}
More information about the Libreoffice-commits
mailing list