vcl/source/gdi/pdfwriter_impl2.cxx | 18 +++++++----------- vcl/source/outdev/transparent.cxx | 27 ++++----------------------- 2 files changed, 11 insertions(+), 34 deletions(-)
New commits: commit f9d5887697405e600cb85cd49b0ce1d8e63cdc27 Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Sat Aug 19 10:47:25 2023 -0400 Commit: Patrick Luby <plub...@neooffice.org> CommitDate: Sat Aug 19 19:31:46 2023 +0200 Eliminate special alpha mask inversions when Skia is disabled Commit ad1f69d28d31725a22e7e1cbb4d950aa9ad3bea7 fixed an alpha blending bug in AlphaMask::BlendWith(const AlphaMask&) so almost all of the special alpha mask inversions when drawing transparent meta actions are no longer needed and so, when Skia is disabled, the same inversions as Skia are now used. The one special alpha mask inversion that is still needed when Skia is disabled is when exporting to PDF documents like the following with transparent gradients: https://bugs.documentfoundation.org/attachment.cgi?id=188084 Change-Id: I3212a38916be3d238bb9c868b161031616baf0a1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155859 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins Reviewed-by: Patrick Luby <plub...@neooffice.org> diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 4e309a2ee8a3..54ff2201ead9 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -499,23 +499,19 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa AlphaMask aAlpha(xVDev->GetBitmap(Point(), xVDev->GetOutputSizePixel())); AlphaMask aPaintAlpha(aPaint.GetAlphaMask()); -#if HAVE_FEATURE_SKIA - // One of the alpha masks is inverted from what + // The alpha mask is inverted from what // is expected so invert it again - if ( SkiaHelper::isVCLSkiaEnabled() ) - { - aAlpha.Invert(); // convert to alpha - } - else -#endif - { - aPaintAlpha.Invert(); // convert to alpha - } + aAlpha.Invert(); // convert to alpha aAlpha.BlendWith(aPaintAlpha); #if HAVE_FEATURE_SKIA if ( !SkiaHelper::isVCLSkiaEnabled() ) #endif { + // When Skia is disabled, the alpha mask + // must be inverted a second time. To test + // this code, export the following + // document to PDF: + // https://bugs.documentfoundation.org/attachment.cgi?id=188084 aAlpha.Invert(); // convert to alpha } diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index df64db2c9b85..f26ca5439982 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -30,7 +30,6 @@ #include <vcl/settings.hxx> #include <vcl/svapp.hxx> #include <vcl/virdev.hxx> -#include <vcl/skia/SkiaHelper.hxx> #include <bitmap/BitmapWriteAccess.hxx> #include <pdf/pdfwriter_impl.hxx> @@ -648,18 +647,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, AlphaMask aAlpha(xVDev->GetBitmap(aPoint, xVDev->GetOutputSizePixel())); AlphaMask aPaintAlpha(aPaint.GetAlphaMask()); -#if HAVE_FEATURE_SKIA - // One of the alpha masks is inverted from what + // The alpha mask is inverted from what // is expected so invert it again - if ( SkiaHelper::isVCLSkiaEnabled() ) - { - aAlpha.Invert(); // convert to alpha - } - else -#endif - { - aPaintAlpha.Invert(); // convert to alpha - } + aAlpha.Invert(); // convert to alpha aAlpha.BlendWith(aPaintAlpha); xVDev.disposeAndClear(); @@ -694,18 +684,9 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos, AlphaMask aAlpha(xVDev->GetBitmap(Point(), xVDev->GetOutputSizePixel())); AlphaMask aPaintAlpha(aPaint.GetAlphaMask()); -#if HAVE_FEATURE_SKIA - // One of the alpha masks is inverted from what + // The alpha mask is inverted from what // is expected so invert it again - if ( SkiaHelper::isVCLSkiaEnabled() ) - { - aAlpha.Invert(); // convert to alpha - } - else -#endif - { - aPaintAlpha.Invert(); // convert to alpha - } + aAlpha.Invert(); // convert to alpha aAlpha.BlendWith(aPaintAlpha); xVDev.disposeAndClear();