[Libreoffice-commits] core.git: sw/source

Heiko Tietze (via logerrit) logerrit at kemper.freedesktop.org
Wed Sep 1 07:21:37 UTC 2021


 sw/source/core/text/inftxt.cxx |   49 +++--------------------------------------
 1 file changed, 4 insertions(+), 45 deletions(-)

New commits:
commit d66ab0c7e8b0330c5c82e37e256557b1a7a6ae03
Author:     Heiko Tietze <tietze.heiko at gmail.com>
AuthorDate: Tue Aug 31 10:46:11 2021 +0200
Commit:     Miklos Vajna <vmiklos at 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 <vmiklos at 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();


More information about the Libreoffice-commits mailing list