sw/source/core/text/inftxt.cxx | 49 +++-------------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-)
New commits: commit d66ab0c7e8b0330c5c82e37e256557b1a7a6ae03 Author: Heiko Tietze <tietze.he...@gmail.com> AuthorDate: Tue Aug 31 10:46:11 2021 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Sep 1 09:21:04 2021 +0200 Resolves tdf#142116 - Respect field shading color on dark background This reverts #100366# commit ce057f404b7b39df4a9259eecd90e28cf9a75fbd Change-Id: I50872e38a154f5d24bcfaafd11488508e3c52356 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121359 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index 4f5df3eb8f17..82f065561a3e 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -521,39 +521,6 @@ SwTextPaintInfo::SwTextPaintInfo( SwTextFrame *pFrame, const SwRect &rPaint ) CtorInitTextPaintInfo( pFrame->getRootFrame()->GetCurrShell()->GetOut(), pFrame, rPaint ); } -/// Returns if the current background color is dark. -static bool lcl_IsDarkBackground( const SwTextPaintInfo& rInf ) -{ - std::optional<Color> pCol = rInf.GetFont()->GetBackColor(); - if( ! pCol || COL_TRANSPARENT == *pCol ) - { - const SvxBrushItem* pItem; - SwRect aOrigBackRect; - drawinglayer::attribute::SdrAllFillAttributesHelperPtr aFillAttributes; - - // Consider, that [GetBackgroundBrush(...)] can set <pCol> - // See implementation in /core/layout/paintfrm.cxx - // There is a background color, if there is a background brush and - // its color is *not* "no fill"/"auto fill". - if( rInf.GetTextFrame()->GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigBackRect, false, /*bConsiderTextBox=*/false ) ) - { - if ( !pCol ) - pCol = pItem->GetColor(); - - // Determined color <pCol> can be <COL_TRANSPARENT>. Thus, check it. - if ( *pCol == COL_TRANSPARENT) - pCol.reset(); - } - else - pCol.reset(); - } - - if( !pCol ) - pCol = aGlobalRetoucheColor; - - return pCol->IsDark(); -} - namespace { /** @@ -1137,20 +1104,12 @@ void SwTextPaintInfo::DrawBackground( const SwLinePortion &rPor, const Color *pC OutputDevice* pOut = const_cast<OutputDevice*>(GetOut()); pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); - // For dark background we do not want to have a filled rectangle - if ( GetVsh() && GetVsh()->GetWin() && lcl_IsDarkBackground( *this ) ) - { - pOut->SetLineColor( SwViewOption::GetFontColor() ); - } + if ( pColor ) + pOut->SetFillColor( *pColor ); else - { - if ( pColor ) - pOut->SetFillColor( *pColor ); - else - pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() ); + pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() ); - pOut->SetLineColor(); - } + pOut->SetLineColor(); DrawRect( aIntersect, true ); pOut->Pop();