drawinglayer/source/tools/converters.cxx | 29 ++++++++++------------------- include/drawinglayer/converters.hxx | 7 +------ svx/source/svdraw/svdpntv.cxx | 4 ++-- svx/source/unodraw/unoshape.cxx | 4 ++-- 4 files changed, 15 insertions(+), 29 deletions(-)
New commits: commit 2e8c9aeb104c54a729f293fab5c0fc44e8903aba Author: Noel Grandin <[email protected]> AuthorDate: Thu Aug 14 13:04:38 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Thu Aug 14 16:31:52 2025 +0200 use Bitmap for convertPrimitive2DContainerToBitmapEx now that Bitmap can support transparency Change-Id: I507d1451e0643ec941f2a72a32db56cccda40b0f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189591 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index bac8a23fbdfd..f9c7db07bad2 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -309,14 +309,14 @@ BitmapEx convertToBitmapEx(drawinglayer::primitive2d::Primitive2DContainer&& rSe return BitmapEx(aRetval); } -BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer&& rSequence, +Bitmap convertPrimitive2DContainerToBitmap(primitive2d::Primitive2DContainer&& rSequence, const basegfx::B2DRange& rTargetRange, sal_uInt32 nMaximumQuadraticPixels, const o3tl::Length eTargetUnit, const std::optional<Size>& rTargetDPI) { if (rSequence.empty()) - return BitmapEx(); + return Bitmap(); try { @@ -341,7 +341,7 @@ BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer const double fHeight(aRange.getHeight()); if (fWidth <= 0.0 || fHeight <= 0.0 || basegfx::fTools::equalZero(fWidth) || basegfx::fTools::equalZero(fHeight)) - return BitmapEx(); + return Bitmap(); if (0 == DPI_X) { @@ -373,16 +373,16 @@ BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer new primitive2d::TransformPrimitive2D(aEmbedding, std::move(rSequence))); primitive2d::Primitive2DContainer xEmbedSeq{ xEmbedRef }; - BitmapEx aBitmapEx(convertToBitmapEx(std::move(xEmbedSeq), aViewInformation2D, + Bitmap aBitmap(convertToBitmapEx(std::move(xEmbedSeq), aViewInformation2D, nDiscreteWidth, nDiscreteHeight, nMaximumQuadraticPixels)); - if (aBitmapEx.IsEmpty()) - return BitmapEx(); - aBitmapEx.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); - aBitmapEx.SetPrefSize(Size(basegfx::fround<tools::Long>(fWidth), basegfx::fround<tools::Long>(fHeight))); + if (aBitmap.IsEmpty()) + return Bitmap(); + aBitmap.SetPrefMapMode(MapMode(MapUnit::Map100thMM)); + aBitmap.SetPrefSize(Size(basegfx::fround<tools::Long>(fWidth), basegfx::fround<tools::Long>(fHeight))); - return aBitmapEx; + return aBitmap; } catch (const css::uno::Exception&) { @@ -393,16 +393,7 @@ BitmapEx convertPrimitive2DContainerToBitmapEx(primitive2d::Primitive2DContainer SAL_WARN("vcl", "Got no graphic::XPrimitive2DRenderer! : " << e.what()); } - return BitmapEx(); -} - -Bitmap convertPrimitive2DContainerToBitmap(primitive2d::Primitive2DContainer&& rSequence, - const basegfx::B2DRange& rTargetRange, - sal_uInt32 nMaximumQuadraticPixels, - const o3tl::Length eTargetUnit, - const std::optional<Size>& rTargetDPI) -{ - return Bitmap(convertPrimitive2DContainerToBitmapEx(std::move(rSequence), rTargetRange, nMaximumQuadraticPixels, eTargetUnit, rTargetDPI)); + return Bitmap(); } } // end of namespace drawinglayer diff --git a/include/drawinglayer/converters.hxx b/include/drawinglayer/converters.hxx index 32cd4ef16616..9534157043b2 100644 --- a/include/drawinglayer/converters.hxx +++ b/include/drawinglayer/converters.hxx @@ -43,13 +43,8 @@ BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx( 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, +// helper to convert any Primitive2DSequence to a good quality Bitmap, // using default parameters -BitmapEx DRAWINGLAYER_DLLPUBLIC convertPrimitive2DContainerToBitmapEx( - drawinglayer::primitive2d::Primitive2DContainer&& rSeq, const basegfx::B2DRange& rTargetRange, - const sal_uInt32 nMaximumQuadraticPixels = 500000, - const o3tl::Length eTargetUnit = o3tl::Length::mm100, - const std::optional<Size>& rTargetDPI = std::nullopt); Bitmap DRAWINGLAYER_DLLPUBLIC convertPrimitive2DContainerToBitmap( drawinglayer::primitive2d::Primitive2DContainer&& rSeq, const basegfx::B2DRange& rTargetRange, const sal_uInt32 nMaximumQuadraticPixels = 500000, diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index e2d26bc8c960..e6547c0ed85a 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -119,10 +119,10 @@ Bitmap convertMetafileToBitmap( rTargetRange.getRange(), rTargetRange.getMinimum()), rMtf)); - aBitmap = Bitmap(drawinglayer::convertPrimitive2DContainerToBitmapEx( + aBitmap = drawinglayer::convertPrimitive2DContainerToBitmap( drawinglayer::primitive2d::Primitive2DContainer { aMtf }, rTargetRange, - nMaximumQuadraticPixels)); + nMaximumQuadraticPixels); } return aBitmap; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index f8a3fd92f883..94c6fb5df86e 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -688,8 +688,8 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const aRange.transform(aMapTransform); } - const BitmapEx aBmp( - drawinglayer::convertPrimitive2DContainerToBitmapEx( + const Bitmap aBmp( + drawinglayer::convertPrimitive2DContainerToBitmap( std::move(xPrimitives), aRange));
