include/vcl/vclenum.hxx                 |    7 ++++++-
 sw/source/core/text/inftxt.cxx          |    4 +++-
 vcl/headless/CairoCommon.cxx            |    1 +
 vcl/unx/generic/gdi/cairotextrender.cxx |    5 +++--
 4 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 30bc5fdb49621269b7281aace610ca85b150766c
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jun 7 19:50:50 2023 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jun 9 12:44:38 2023 +0200

    Related: CollaboraOnline#6511 cairo backend can do transparent text
    
    and avoid the extra work required here for the generic case.
    
    keep the transparency helper for the other backends, or any case where
    we may be recording to metafile, or pdf export etc
    
    Change-Id: Ic01b8b69f2d59e585605ce1e981298fda9185824
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152719
    Reviewed-by: Michael Meeks <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/include/vcl/vclenum.hxx b/include/vcl/vclenum.hxx
index 8e38593c047c..9f9abd75d1df 100644
--- a/include/vcl/vclenum.hxx
+++ b/include/vcl/vclenum.hxx
@@ -159,7 +159,12 @@ enum class LineStyle
 
 typedef sal_uInt32 sal_UCS4;    // TODO: this should be moved to rtl
 
-enum class OutDevSupportType { TransparentRect, B2DDraw };
+enum class OutDevSupportType
+{
+    TransparentRect,
+    B2DDraw,
+    TransparentText     // if alpha in TextColor can be honored
+};
 
 struct ItalicMatrix
 {
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 32676958c914..f67f4e580292 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -698,7 +698,9 @@ void SwTextPaintInfo::DrawText_( const OUString &rText, 
const SwLinePortion &rPo
     std::unique_ptr<SwTransparentTextGuard, 
o3tl::default_delete<SwTransparentTextGuard>> pTransparentText;
     if (m_pFnt->GetColor() != COL_AUTO && m_pFnt->GetColor().IsTransparent())
     {
-        pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, 
aDrawInf));
+        // if drawing to a backend that supports transparency for text color, 
then we don't need to use this
+        if (!m_bOnWin || 
!m_pOut->SupportsOperation(OutDevSupportType::TransparentText) || 
m_pOut->GetConnectMetaFile())
+            pTransparentText.reset(new SwTransparentTextGuard(rPor, *this, 
aDrawInf));
     }
 
     if( GetTextFly().IsOn() )
diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 9c67fb079566..a0a0a05b89bc 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1980,6 +1980,7 @@ bool CairoCommon::supportsOperation(OutDevSupportType 
eType)
     switch (eType)
     {
         case OutDevSupportType::TransparentRect:
+        case OutDevSupportType::TransparentText:
         case OutDevSupportType::B2DDraw:
             return true;
     }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index f962c21d39ed..8390e47680be 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -343,10 +343,11 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
 
     clipRegion(cr);
 
-    cairo_set_source_rgb(cr,
+    cairo_set_source_rgba(cr,
         mnTextColor.GetRed()/255.0,
         mnTextColor.GetGreen()/255.0,
-        mnTextColor.GetBlue()/255.0);
+        mnTextColor.GetBlue()/255.0,
+        mnTextColor.GetAlpha()/255.0);
 
     int nRatio = nWidth * 10 / nHeight;
 

Reply via email to