diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-05-04 16:08:35 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-05-07 21:02:22 +0200 |
commit | 1ef26ffe39618a745d3367310565e7eeb184a4c2 (patch) | |
tree | 0c37afc8591f7f5de32403065147d84c55d2c427 /emfio/source | |
parent | 13ce37a85ac73a88567c2066fac694e4fc02a6f8 (diff) |
tdf#55058 tdf#141982 EMF: Add rotation support for INTERSECTCLIPRECT record
With this commit the rotation support was added
for INTERSECTCLIPRECT.
Before that change rotation was not applied to these CLIP rectangles.
Change-Id: I3da66790e0aeeaaeeb28d2fc30780cba8dbda390
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115102
Tested-by: Jenkins
Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio/source')
-rw-r--r-- | emfio/source/reader/mtftools.cxx | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx index 4e325c10622e..2b1c1d406d1b 100644 --- a/emfio/source/reader/mtftools.cxx +++ b/emfio/source/reader/mtftools.cxx @@ -66,19 +66,18 @@ namespace emfio return rInStream; } - void WinMtfClipPath::intersectClipRect( const tools::Rectangle& rRect ) + void WinMtfClipPath::intersectClip( const basegfx::B2DPolyPolygon& rPolyPolygon ) { - maClip.intersectRange(vcl::unotools::b2DRectangleFromRectangle(rRect)); + maClip.intersectPolyPolygon(rPolyPolygon); } - void WinMtfClipPath::excludeClipRect( const tools::Rectangle& rRect ) + void WinMtfClipPath::excludeClip( const basegfx::B2DPolyPolygon& rPolyPolygon ) { - maClip.subtractRange(vcl::unotools::b2DRectangleFromRectangle(rRect)); + maClip.subtractPolyPolygon(rPolyPolygon); } - void WinMtfClipPath::setClipPath( const tools::PolyPolygon& rPolyPolygon, sal_Int32 nClippingMode ) + void WinMtfClipPath::setClipPath( const basegfx::B2DPolyPolygon& rB2DPoly, sal_Int32 nClippingMode ) { - const basegfx::B2DPolyPolygon& rB2DPoly=rPolyPolygon.getB2DPolyPolygon(); switch ( nClippingMode ) { case RGN_OR : @@ -1032,7 +1031,15 @@ namespace emfio { return; // empty rectangles cause trouble } - maClipPath.intersectClipRect( ImplMap( rRect ) ); + Point aPoints[] { Point(rRect.Left(), rRect.Top()), + Point(rRect.Right(), rRect.Top()), + Point(rRect.Right(), rRect.Bottom()), + Point(rRect.Left(), rRect.Bottom()) }; + tools::Polygon aPoly(4, aPoints); + aPoly = ImplMap( aPoly ); + aPoly.Optimize( PolyOptimizeFlags::CLOSE ); + tools::PolyPolygon aPolyPolyRect( aPoly ); + maClipPath.intersectClip( aPolyPolyRect.getB2DPolyPolygon() ); } void MtfTools::ExcludeClipRect( const tools::Rectangle& rRect ) @@ -1040,7 +1047,16 @@ namespace emfio if (utl::ConfigManager::IsFuzzing()) return; mbClipNeedsUpdate=true; - maClipPath.excludeClipRect( ImplMap( rRect ) ); + + Point aPoints[] { Point(rRect.Left(), rRect.Top()), + Point(rRect.Right(), rRect.Top()), + Point(rRect.Right(), rRect.Bottom()), + Point(rRect.Left(), rRect.Bottom()) }; + tools::Polygon aPoly(4, aPoints); + aPoly = ImplMap( aPoly ); + aPoly.Optimize( PolyOptimizeFlags::CLOSE ); + tools::PolyPolygon aPolyPolyRect( aPoly ); + maClipPath.excludeClip( aPolyPolyRect.getB2DPolyPolygon() ); } void MtfTools::MoveClipRegion( const Size& rSize ) @@ -1065,7 +1081,7 @@ namespace emfio else aPolyPolygon = ImplMap(aPolyPolygon); } - maClipPath.setClipPath(aPolyPolygon, nClippingMode); + maClipPath.setClipPath(aPolyPolygon.getB2DPolyPolygon(), nClippingMode); } void MtfTools::SetDefaultClipPath() |