From ad65448f3a3c1186c2c86970cbb7df1c48f81ba7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 13 Dec 2024 16:27:32 +0000 Subject: Get the style color and number just once MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4dfa6feb1f41f9c62bd025ff521adc011c655926 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178453 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- sw/source/core/layout/paintfrm.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sw') diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 68486df83780..a24963e7afca 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -4576,15 +4576,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(aRect); // 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); @@ -4593,8 +4596,8 @@ void SwTextFrame::PaintParagraphStylesHighlighting() const pRenderContext->SetFont(aFont); pRenderContext->SetLayoutMode(vcl::text::ComplexTextLayoutFlags::Default); - pRenderContext->SetTextFillColor(rParaStylesColorMap[sStyleName].first); - pRenderContext->DrawText(aRect, OUString::number(rParaStylesColorMap[sStyleName].second), + pRenderContext->SetTextFillColor(nStyleColor); + pRenderContext->DrawText(aRect, OUString::number(nStyleNumber), DrawTextFlags::Center | DrawTextFlags::VCenter); pRenderContext->Pop(); -- cgit