From 9acb4d4605411c308c8e064b4a4855615046c7f1 Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Fri, 28 Jun 2024 18:31:14 -0400 Subject: tdf#161833 treat semi-transparent pixels as opaque Limiting the contour wrapping polygon to only opaque pixels causes clipping of any shadows or other semi-transaprent areas in the image. So, instead of testing for fully opaque pixels, treat pixels that are not fully transparent as opaque. Also, tdf#161833 would cause semi-transparent pixels to be treated as fully transparent pixels when calculating the wrap contour for an image. To force the correct contour when loading a document, force the contour to be recalculated by ignoring the saved polygon if the contour is set to "recreate on edit". Change-Id: Ibe256f54e1c82de30c2b7d5b92a69344b4a7ba10 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169745 Reviewed-by: Patrick Luby Reviewed-by: Noel Grandin Tested-by: Jenkins (cherry picked from commit 3da1d8a791cff6cf2dad29b64c9ad15b1a65d5b3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169955 --- xmloff/source/text/XMLTextFrameContext.cxx | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 87752f73b199..5c293c7670c2 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -271,17 +271,26 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( const SdXMLImExViewBox aViewBox( sViewBox, GetImport().GetMM100UnitConverter()); basegfx::B2DPolyPolygon aPolyPolygon; - if( bPath ) + // Related tdf#161833: ignore saved polygon for "recreate on edit" contours + // tdf#161833 would cause semi-transparent pixels to be treated as fully + // transparent pixels when calculating the wrap contour for an image. To + // force the correct contour when loading a document, force the contour + // to be recalculated by ignoring the saved polygon if the contour is set + // to "recreate on edit". + if( !bAuto ) { - basegfx::utils::importFromSvgD(aPolyPolygon, sD, GetImport().needFixPositionAfterZ(), nullptr); - } - else - { - basegfx::B2DPolygon aPolygon; - - if(basegfx::utils::importFromSvgPoints(aPolygon, sPoints)) + if( bPath ) { - aPolyPolygon = basegfx::B2DPolyPolygon(aPolygon); + basegfx::utils::importFromSvgD(aPolyPolygon, sD, GetImport().needFixPositionAfterZ(), nullptr); + } + else + { + basegfx::B2DPolygon aPolygon; + + if(basegfx::utils::importFromSvgPoints(aPolygon, sPoints)) + { + aPolyPolygon = basegfx::B2DPolyPolygon(aPolygon); + } } } -- cgit