From 485ae0bc7e1a1d615dd1d4133d3e42d655dec029 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Fri, 15 Mar 2024 11:15:08 +0100 Subject: tdf#48062: use mergeToSinglePolyPolygon instead of createPolygonFromRect Otherwise, in files like https://bug-attachments.documentfoundation.org/attachment.cgi?id=193126 where no rectangles are used the mask is displayed as a rectangle Change-Id: I8cafb22bd6055db729d0d56b4756119d7989abb2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164863 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- svgio/source/svgreader/svgfecompositenode.cxx | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'svgio/source') diff --git a/svgio/source/svgreader/svgfecompositenode.cxx b/svgio/source/svgreader/svgfecompositenode.cxx index 1e20a0ef00f2..88ba5c62df68 100644 --- a/svgio/source/svgreader/svgfecompositenode.cxx +++ b/svgio/source/svgreader/svgfecompositenode.cxx @@ -22,6 +22,7 @@ #include #include #include +#include namespace svgio::svgreader { @@ -102,20 +103,22 @@ void SvgFeCompositeNode::apply(drawinglayer::primitive2d::Primitive2DContainer& = pParent->findGraphicSource(maIn2)) { rTarget.append(*pSource2); - const basegfx::B2DRange aRange2( - pSource2->getB2DRange(drawinglayer::geometry::ViewInformation2D())); - - aPolyPolygon2 = basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(aRange2)); + drawinglayer::processor2d::ContourExtractor2D aExtractor( + drawinglayer::geometry::ViewInformation2D(), true); + aExtractor.process(*pSource2); + const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour()); + aPolyPolygon2 = basegfx::utils::mergeToSinglePolyPolygon(rResult); } if (const drawinglayer::primitive2d::Primitive2DContainer* pSource = pParent->findGraphicSource(maIn)) { rTarget.append(*pSource); - const basegfx::B2DRange aRange( - pSource->getB2DRange(drawinglayer::geometry::ViewInformation2D())); - - aPolyPolygon = basegfx::B2DPolyPolygon(basegfx::utils::createPolygonFromRect(aRange)); + drawinglayer::processor2d::ContourExtractor2D aExtractor( + drawinglayer::geometry::ViewInformation2D(), true); + aExtractor.process(*pSource); + const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour()); + aPolyPolygon = basegfx::utils::mergeToSinglePolyPolygon(rResult); } basegfx::B2DPolyPolygon aResult; -- cgit