summaryrefslogtreecommitdiff
path: root/emfio/source/reader/mtftools.cxx
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-04 16:08:35 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-05-10 10:10:23 +0200
commita67a30227ef32ab9fc3026bb19e48d4447df25d1 (patch)
tree8871c6d58359e72261b4b6c702ce990e23edac41 /emfio/source/reader/mtftools.cxx
parentb2fc048cb2d5f5bd1095a8110fa4a16a305a8acc (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> (cherry picked from commit 1ef26ffe39618a745d3367310565e7eeb184a4c2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115207 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'emfio/source/reader/mtftools.cxx')
-rw-r--r--emfio/source/reader/mtftools.cxx34
1 files changed, 25 insertions, 9 deletions
diff --git a/emfio/source/reader/mtftools.cxx b/emfio/source/reader/mtftools.cxx
index 092e26d3a0d9..d54e0ff763ae 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 :
@@ -1014,7 +1013,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 )
@@ -1022,7 +1029,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 )
@@ -1047,7 +1063,7 @@ namespace emfio
else
aPolyPolygon = ImplMap(aPolyPolygon);
}
- maClipPath.setClipPath(aPolyPolygon, nClippingMode);
+ maClipPath.setClipPath(aPolyPolygon.getB2DPolyPolygon(), nClippingMode);
}
void MtfTools::SetDefaultClipPath()