vcl/source/bitmap/BitmapTools.cxx | 5 ++++- vcl/source/graphic/UnoGraphic.cxx | 9 ++------- 2 files changed, 6 insertions(+), 8 deletions(-)
New commits: commit 0d5fed1269e96222774d8092a98a4166f02814fc Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Thu May 22 12:34:51 2025 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Thu May 22 22:02:53 2025 +0200 Related: tdf#163381 Fix and unify on vcl::bitmap::GetMaskDIB Commit bb6db3aa4c86b92e8321d6734bcb34ba28dfeb27 (tdf#163381 XBitmap.getMaskDIB() is inverted, 2024-10-16) has fixed the implementation of getMaskDIB in unographic::Graphic. There is another XBitmap implementation that needs the same fix: VCLXBitmap. It uses vcl::bitmap::GetMaskDIB for the task; and that may be also reused in unographic::Graphic, after the fix. Change-Id: Ic0349bcb49e66246765dc7e4deed566b4c4b9094 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185657 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx index 9c23507bcb8a..b79928149f6f 100644 --- a/vcl/source/bitmap/BitmapTools.cxx +++ b/vcl/source/bitmap/BitmapTools.cxx @@ -678,7 +678,10 @@ css::uno::Sequence< sal_Int8 > GetMaskDIB(BitmapEx const & aBmpEx) if ( aBmpEx.IsAlpha() ) { SvMemoryStream aMem; - WriteDIB(aBmpEx.GetAlphaMask().GetBitmap(), aMem, false, true); + AlphaMask aMask = aBmpEx.GetAlphaMask(); + // for backwards compatibility for extensions, we need to convert from alpha to transparency + aMask.Invert(); + WriteDIB(aMask.GetBitmap(), aMem, false, true); return css::uno::Sequence< sal_Int8 >( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() ); } diff --git a/vcl/source/graphic/UnoGraphic.cxx b/vcl/source/graphic/UnoGraphic.cxx index 7e1f1234790a..da9f8f0b74d9 100644 --- a/vcl/source/graphic/UnoGraphic.cxx +++ b/vcl/source/graphic/UnoGraphic.cxx @@ -26,6 +26,7 @@ #include <vcl/dibtools.hxx> #include <vcl/graph.hxx> #include <vcl/BitmapColor.hxx> +#include <vcl/BitmapTools.hxx> #include <comphelper/servicehelper.hxx> #include <cppuhelper/supportsservice.hxx> #include <cppuhelper/queryinterface.hxx> @@ -164,13 +165,7 @@ uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB() if (!maGraphic.IsNone()) { - SvMemoryStream aMemoryStream; - - AlphaMask aMask = maGraphic.GetBitmapEx().GetAlphaMask(); - // for backwards compatibility for extensions, we need to convert from alpha to transparency - aMask.Invert(); - WriteDIB(aMask.GetBitmap(), aMemoryStream, false, true); - return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMemoryStream.GetData()), aMemoryStream.Tell() ); + return vcl::bitmap::GetMaskDIB(maGraphic.GetBitmapEx()); } else {