tdf#161501 icon choice ctrl: Simplify and drop extra local variable

No need to have a `bSolidTextRect` variable here,
just do the relevant call right away.

That also means that there's no need to save
and restore the previous fill color for the
`bSelected = true` case (it never gets changed),
so move that into the if block as well.

Change-Id: I57637e570b01e2a09708fc7776c867817a131d31
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170844
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
Tested-by: Jenkins
This commit is contained in:
Michael Weghorn 2024-07-22 09:13:00 +02:00
parent 3720078422
commit 9288e66770

View file

@ -962,25 +962,17 @@ void SvxIconChoiceCtrl_Impl::LoseFocus()
void SvxIconChoiceCtrl_Impl::PaintEmphasis(const tools::Rectangle& rTextRect, bool bSelected,
vcl::RenderContext& rRenderContext)
{
Color aOldFillColor(rRenderContext.GetFillColor());
bool bSolidTextRect = false;
if (!bSelected)
{
Color aOldFillColor(rRenderContext.GetFillColor());
const Color& rFillColor = rRenderContext.GetFont().GetFillColor();
rRenderContext.SetFillColor(rFillColor);
// draw text rectangle
if (rFillColor != COL_TRANSPARENT)
bSolidTextRect = true;
}
rRenderContext.DrawRect(rTextRect);
// draw text rectangle
if (bSolidTextRect)
{
rRenderContext.DrawRect(rTextRect);
rRenderContext.SetFillColor(aOldFillColor);
}
rRenderContext.SetFillColor(aOldFillColor);
}