CreateAlphaMask + CreateColorBitmap -> SplitIntoColorAndAlpha

See commit f7b67e6c8c5981790fb9ac162dcc68e470b53112 (pdfexport: reduce
the number of times we split images, 2026-08-19) for rationale.

While at that: drop the check added in commit
e06456180a (crashtesting: crash on export
of forum-en-41439.odp to pdf, 2023-07-27), which was obsoleted by commit
4942aa1533 (tdf#156808 force an alpha mask
to be created even if it has no alpha, 2023-09-14).

Change-Id: I318c24629676b115c34cc42333bdcb136c420bd9
Signed-off-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9510
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
(cherry picked from commit 69c9ed699924b40cd05f08bca30cce115bb629ff)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209509
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
Mike Kaganski
2026-08-23 13:27:34 +02:00
committed by Xisco Fauli
parent d385b81da3
commit 60c92f9752
@@ -203,16 +203,15 @@ void SoftEdgePrimitive2D::create2DDecomposition(
fScale = (fScaleX + fScaleY) * 0.5;
}
assert(aBitmap.HasAlpha());
auto [aColor, aMask] = aBitmap.SplitIntoColorAndAlpha();
// Get the Alpha and use as base to blur and apply the effect
AlphaMask aMask(aBitmap.CreateAlphaMask());
if (aMask.IsEmpty()) // There is no mask, fully opaque
break;
AlphaMask blurMask(drawinglayer::primitive2d::ProcessAndBlurAlphaMask(
aMask, -fDiscreteSoftRadius * fScale, fDiscreteSoftRadius * fScale, 0));
aMask.BlendWith(blurMask);
// The end result is the original bitmap with blurred 8-bit alpha mask
Bitmap result(aBitmap.CreateColorBitmap(), aMask);
Bitmap result(aColor, aMask);
#ifdef DBG_UTIL
static bool bDoSaveForVisualControl(false); // loplugin:constvars:ignore