drawinglayer/source/processor2d/cairopixelprocessor2d.cxx |   21 ++++++++------
 1 file changed, 13 insertions(+), 8 deletions(-)

New commits:
commit bece17ca694093f9cd19ec99e45f5e603ecd2851
Author:     Armin Le Grand (Collabora) <armin.le.gr...@me.com>
AuthorDate: Mon Aug 5 14:37:25 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Tue Aug 6 16:52:22 2024 +0200

    CairoSDPR: Support TextBackgroundFill
    
    Change-Id: Ifa00a230ad88d49ccda7c7f47b3d87870d4dfc3c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171489
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>
    Tested-by: Jenkins

diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx 
b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
index f6869a97aa1c..62e009e62bc9 100644
--- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx
@@ -2859,14 +2859,6 @@ void 
CairoPixelProcessor2D::renderTextSimpleOrDecoratedPortionPrimitive2D(
         return;
     }
 
-    // set FillColor Attribute at Font
-    Color aFillColor(
-        
maBColorModifierStack.getModifiedColor(rTextCandidate.getTextFillColor().getBColor()));
-    aFont.SetTransparent(rTextCandidate.getTextFillColor().IsTransparent());
-    if (rTextCandidate.getTextFillColor().IsTransparent())
-        aFillColor.SetAlpha(rTextCandidate.getTextFillColor().GetAlpha());
-    aFont.SetFillColor(aFillColor);
-
     // create integer DXArray. As mentioned above we can act in the
     // Text's local coordinate system without transformation at all
     const ::std::vector<double>& rDXArray(rTextCandidate.getDXArray());
@@ -2933,6 +2925,19 @@ void 
CairoPixelProcessor2D::renderTextSimpleOrDecoratedPortionPrimitive2D(
                       aFullTextTransform.c(), aFullTextTransform.d(), 
aFullTextTransform.e(),
                       aFullTextTransform.f());
     cairo_set_matrix(mpRT, &aMatrix);
+
+    if (!rTextCandidate.getTextFillColor().IsTransparent())
+    {
+        // TextFillColor is set -> text background is filled, paint it
+        const basegfx::BColor aFillColor(
+            
maBColorModifierStack.getModifiedColor(rTextCandidate.getTextFillColor().getBColor()));
+        cairo_set_source_rgb(mpRT, aFillColor.getRed(), aFillColor.getGreen(),
+                             aFillColor.getBlue());
+        cairo_rectangle(mpRT, 0.0, -aTextLayouter.getFontAscent(), 
pSalLayout->GetTextWidth(),
+                        aTextLayouter.getTextHeight());
+        cairo_fill(mpRT);
+    }
+
     pSalLayout->drawSalLayout(mpRT, aRGBFontColor, 
getViewInformation2D().getUseAntiAliasing());
     cairo_restore(mpRT);
 }

Reply via email to