sw/source/core/layout/paintfrm.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit 435eca4b1639b8fc9029f8010b4cc0a184e69f0b
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Fri Dec 13 16:27:32 2024 +0000
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Dec 16 12:00:26 2024 +0100

    Get the style color and number just once
    
    Change-Id: I4dfa6feb1f41f9c62bd025ff521adc011c655926
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178454
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/source/core/layout/paintfrm.cxx 
b/sw/source/core/layout/paintfrm.cxx
index d677c87d382f..4261ddf3a032 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -4614,15 +4614,18 @@ void SwTextFrame::PaintParagraphStylesHighlighting() 
const
 
         pRenderContext->Push(vcl::PushFlags::ALL);
 
-        pRenderContext->SetFillColor(rParaStylesColorMap[sStyleName].first);
-        pRenderContext->SetLineColor(rParaStylesColorMap[sStyleName].first);
+        Color nStyleColor = rParaStylesColorMap[sStyleName].first;
+        int nStyleNumber = rParaStylesColorMap[sStyleName].second;
+
+        pRenderContext->SetFillColor(nStyleColor);
+        pRenderContext->SetLineColor(nStyleColor);
 
         pRenderContext->DrawRect(rRect);
 
         // draw hatch pattern if paragraph has direct formatting
         if 
(SwDoc::HasParagraphDirectFormatting(SwPosition(*GetTextNodeForParaProps())))
         {
-            Color aHatchColor(rParaStylesColorMap[sStyleName].first);
+            Color aHatchColor(nStyleColor);
             // make hatch line color 41% darker than the fill color
             aHatchColor.ApplyTintOrShade(-4100);
             Hatch aHatch(HatchStyle::Single, aHatchColor, 50, 450_deg10);
@@ -4631,8 +4634,8 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const
 
         pRenderContext->SetFont(aFont);
         
pRenderContext->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default);
-        
pRenderContext->SetTextFillColor(rParaStylesColorMap[sStyleName].first);
-        pRenderContext->DrawText(rRect, 
OUString::number(rParaStylesColorMap[sStyleName].second),
+        pRenderContext->SetTextFillColor(nStyleColor);
+        pRenderContext->DrawText(rRect, OUString::number(nStyleNumber),
                                  DrawTextFlags::Center | 
DrawTextFlags::VCenter);
 
         pRenderContext->Pop();

Reply via email to