include/vcl/skia/SkiaHelper.hxx | 1 + vcl/skia/SkiaHelper.cxx | 3 +++ vcl/skia/gdiimpl.cxx | 10 ++++++++++ vcl/source/outdev/bitmap.cxx | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-)
New commits: commit cde3a60e99ea52fb5d5e27963c74f1526a0560c7 Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Thu Jul 20 09:22:46 2023 -0400 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Jul 21 10:14:19 2023 +0200 tdf#156361 use slow blending path if alpha mask blending is diabled SkiaSalGraphicsImpl::blendBitmap() fails unexpectedly in the following cases so return false and use the non-Skia alpha mask blending code: - Unexpected white areas when running a slideshow or printing: https://bugs.documentfoundation.org/attachment.cgi?id=188447 - Unexpected scaling of bitmap and/or alpha mask when exporting to PDF: https://bugs.documentfoundation.org/attachment.cgi?id=188498 Change-Id: I13ae613f24bff4cd018110a08ed70559a1714687 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154690 Reviewed-by: Patrick Luby <plub...@neooffice.org> Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/vcl/skia/SkiaHelper.hxx b/include/vcl/skia/SkiaHelper.hxx index 37fed7ff4de9..769c4d27a9ac 100644 --- a/include/vcl/skia/SkiaHelper.hxx +++ b/include/vcl/skia/SkiaHelper.hxx @@ -19,6 +19,7 @@ namespace SkiaHelper { VCL_DLLPUBLIC bool isVCLSkiaEnabled(); VCL_DLLPUBLIC OUString readLog(); +VCL_DLLPUBLIC bool isAlphaMaskBlendingEnabled(); #if HAVE_FEATURE_SKIA diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 16cbdd306fd1..9875b7846631 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -18,6 +18,7 @@ namespace SkiaHelper { bool isVCLSkiaEnabled() { return false; } +bool isAlphaMaskBlendingEnabled() { return false; } } // namespace @@ -369,6 +370,8 @@ bool isVCLSkiaEnabled() return bRet; } +bool isAlphaMaskBlendingEnabled() { return false; } + static RenderMethod methodToUse = RenderRaster; static bool initRenderMethodToUse() diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index cc823e4ccdd4..7145644b01eb 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -1297,6 +1297,16 @@ bool SkiaSalGraphicsImpl::blendAlphaBitmap(const SalTwoRect& rPosAry, const SalBitmap& rMaskBitmap, const SalBitmap& rAlphaBitmap) { + // tdf#156361 use slow blending path if alpha mask blending is diabled + // SkiaSalGraphicsImpl::blendBitmap() fails unexpectedly in the following + // cases so return false and use the non-Skia alpha mask blending code: + // - Unexpected white areas when running a slideshow or printing: + // https://bugs.documentfoundation.org/attachment.cgi?id=188447 + // - Unexpected scaling of bitmap and/or alpha mask when exporting to PDF: + // https://bugs.documentfoundation.org/attachment.cgi?id=188498 + if (!SkiaHelper::isAlphaMaskBlendingEnabled()) + return false; + if (checkInvalidSourceOrDestination(rPosAry)) return false; diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 8e453e835904..90f8271b544c 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -358,7 +358,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r // we need to make sure Skia never reaches this slow code path // (but do not fail in no-op cases) - assert(!SkiaHelper::isVCLSkiaEnabled() + assert(!SkiaHelper::isVCLSkiaEnabled() || !SkiaHelper::isAlphaMaskBlendingEnabled() || tools::Rectangle(Point(), rBmp.GetSizePixel()) .Intersection(tools::Rectangle(rSrcPtPixel, rSrcSizePixel)).IsEmpty() || mpAlphaVDev->LogicToPixel(mpAlphaVDev->GetOutputSizePixel()).IsEmpty());