drawinglayer/source/primitive2d/softedgeprimitive2d.cxx |    7 ++++++-
 drawinglayer/source/tools/converters.cxx                |    4 ++--
 include/drawinglayer/converters.hxx                     |    8 ++++----
 3 files changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 4942aa1533af25cf102da7516bd5e521c553aa07
Author:     Patrick Luby <plub...@neooffice.org>
AuthorDate: Wed Sep 13 18:52:29 2023 -0400
Commit:     Patrick Luby <plub...@neooffice.org>
CommitDate: Thu Sep 14 01:52:22 2023 +0200

    tdf#156808 force an alpha mask to be created even if it has no alpha
    
    We need an alpha mask, even if it is totally opaque, so that
    drawinglayer::primitive2d::ProcessAndBlurAlphaMask() can be called.
    Otherwise, blurring of edges will fail in cases like running in a
    slideshow or exporting to PDF.
    
    Change-Id: If03b32a8a22ed960f1475710a9831cab33799b60
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156903
    Tested-by: Jenkins
    Reviewed-by: Patrick Luby <plub...@neooffice.org>

diff --git a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx 
b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
index 89e1fd545fcb..bfd8ebf71656 100644
--- a/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/softedgeprimitive2d.cxx
@@ -166,9 +166,14 @@ void SoftEdgePrimitive2D::create2DDecomposition(
         const sal_uInt32 
nDiscreteClippedHeight(ceil(aDiscreteClippedSize.getY()));
         const geometry::ViewInformation2D aViewInformation2D;
         const sal_uInt32 nMaximumQuadraticPixels(250000);
+        // tdf#156808 force an alpha mask to be created even if it has no alpha
+        // We need an alpha mask, even if it is totally opaque, so that
+        // drawinglayer::primitive2d::ProcessAndBlurAlphaMask() can be called.
+        // Otherwise, blurring of edges will fail in cases like running in a
+        // slideshow or exporting to PDF.
         const BitmapEx aBitmapEx(::drawinglayer::convertToBitmapEx(
             std::move(xEmbedSeq), aViewInformation2D, nDiscreteClippedWidth, 
nDiscreteClippedHeight,
-            nMaximumQuadraticPixels));
+            nMaximumQuadraticPixels, true));
 
         if (aBitmapEx.IsEmpty())
             break;
diff --git a/drawinglayer/source/tools/converters.cxx 
b/drawinglayer/source/tools/converters.cxx
index 80ae15a3b6a9..9283f7db779f 100644
--- a/drawinglayer/source/tools/converters.cxx
+++ b/drawinglayer/source/tools/converters.cxx
@@ -156,7 +156,7 @@ AlphaMask 
createAlphaMask(drawinglayer::primitive2d::Primitive2DContainer&& rSeq
 BitmapEx convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& 
rSeq,
                            const geometry::ViewInformation2D& 
rViewInformation2D,
                            sal_uInt32 nDiscreteWidth, sal_uInt32 
nDiscreteHeight,
-                           sal_uInt32 nMaxSquarePixels)
+                           sal_uInt32 nMaxSquarePixels, bool 
bForceAlphaMaskCreation)
 {
     drawinglayer::primitive2d::Primitive2DContainer aSequence(std::move(rSeq));
 
@@ -261,7 +261,7 @@ BitmapEx 
convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe
     }
 #endif
 
-    if (aAlpha.hasAlpha())
+    if (bForceAlphaMaskCreation || aAlpha.hasAlpha())
     {
         // Need to correct content using known alpha to get to background-free
         // RGBA result, usable e.g. in PNG export(s) or convert-to-bitmap.
diff --git a/include/drawinglayer/converters.hxx 
b/include/drawinglayer/converters.hxx
index 0b4a5649874e..d090b1e0a921 100644
--- a/include/drawinglayer/converters.hxx
+++ b/include/drawinglayer/converters.hxx
@@ -38,10 +38,10 @@ AlphaMask DRAWINGLAYER_DLLPUBLIC createAlphaMask(
 
 // Helper for convertPrimitive2DContainerToBitmapEx below, but can be also used
 // directly
-BitmapEx DRAWINGLAYER_DLLPUBLIC
-convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
-                  const geometry::ViewInformation2D& rViewInformation2D, 
sal_uInt32 nDiscreteWidth,
-                  sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels);
+BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx(
+    drawinglayer::primitive2d::Primitive2DContainer&& rSeq,
+    const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 
nDiscreteWidth,
+    sal_uInt32 nDiscreteHeight, sal_uInt32 nMaxSquarePixels, bool 
bForceAlphaMaskCreation = false);
 
 // helper to convert any Primitive2DSequence to a good quality BitmapEx,
 // using default parameters

Reply via email to