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

New commits:
commit cb4f72a94ed661ed6b0d2ca7259158d6d8ed9fd1
Author:     Caolán McNamara <[email protected]>
AuthorDate: Wed Jun 7 19:50:50 2023 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Jun 9 11:22:25 2023 +0200

    Related: CollaboraOnline#6511 cairo backend can do transparent text
    
    and avoid the extra work required here for the generic case
    
    Change-Id: Ic01b8b69f2d59e585605ce1e981298fda9185824
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152784
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Miklos Vajna <[email protected]>

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 d4e15a47b9c3..904f2ace19ab 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -687,7 +687,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/SvpGraphicsBackend.cxx 
b/vcl/headless/SvpGraphicsBackend.cxx
index 2a0055c08029..f979cacd5b49 100644
--- a/vcl/headless/SvpGraphicsBackend.cxx
+++ b/vcl/headless/SvpGraphicsBackend.cxx
@@ -1000,6 +1000,7 @@ bool 
SvpGraphicsBackend::supportsOperation(OutDevSupportType eType) const
     {
         case OutDevSupportType::TransparentRect:
         case OutDevSupportType::B2DDraw:
+        case OutDevSupportType::TransparentText:
             return true;
     }
     return false;
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 0a10f6708faf..9662c3e4bd11 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -334,10 +334,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);
 
     FT_Face aFace = rFont.GetFtFace();
     CairoFontsCache::CacheId aId;

Reply via email to