summaryrefslogtreecommitdiffstats
path: root/emfio/source
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-06 17:43:57 +0200
committerAndras Timar <andras.timar@collabora.com>2021-05-16 23:47:21 +0200
commitf1a2e77d272f8761ccd11737c559a04755ddee62 (patch)
tree8129f7a58dff0ee1e255029e87186348ebeb01a8 /emfio/source
parenttdf#126226, tdf#126735 sw Next Change: cycle through tracked changes (diff)
downloadcore-f1a2e77d272f8761ccd11737c559a04755ddee62.tar.gz
core-f1a2e77d272f8761ccd11737c559a04755ddee62.zip
tdf#55058 tdf#141982 EMF: Add rotation support for ARC, ARCTO, CHORD, PIE
Change-Id: I5d9b76f0ddd2b7f12604f472986dd95976a8b04d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115185 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl> (cherry picked from commit 6bf2239a189423d087b2536dd7054b21df58ddc4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115198 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'emfio/source')
-rw-r--r--emfio/source/reader/emfreader.cxx36
1 files changed, 17 insertions, 19 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index 4691eff85410..9375da294180 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1351,18 +1351,17 @@ namespace emfio
break;
case EMR_ARC :
- {
- sal_uInt32 nStartX, nStartY, nEndX, nEndY;
- mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY ).ReadUInt32( nEndX ).ReadUInt32( nEndY );
- DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
- }
- break;
-
+ case EMR_ARCTO :
case EMR_CHORD :
{
sal_uInt32 nStartX, nStartY, nEndX, nEndY;
mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY ).ReadUInt32( nEndX ).ReadUInt32( nEndY );
- DrawChord( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+ tools::Polygon aPoly( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Arc );
+ aPoly.Optimize( PolyOptimizeFlags::EDGES );
+ if ( nRecType == EMR_CHORD )
+ DrawPolygon( aPoly, mbRecordPath );
+ else
+ DrawPolyLine( aPoly, nRecType == EMR_ARCTO, mbRecordPath );
}
break;
@@ -1370,14 +1369,21 @@ namespace emfio
{
sal_uInt32 nStartX, nStartY, nEndX, nEndY;
mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY ).ReadUInt32( nEndX ).ReadUInt32( nEndY );
- const tools::Rectangle aRect( ReadRectangle( nX32, nY32, nx32, ny32 ));
+ tools::Polygon aPoly;
// #i73608# OutputDevice deviates from WMF
// semantics. start==end means full ellipse here.
if( nStartX == nEndX && nStartY == nEndY )
- DrawEllipse( aRect );
+ {
+ tools::Long dw = (nx32 - nX32) / 2;
+ tools::Long dh = (ny32 - nY32) / 2;
+ Point aCenter( nX32 + dw, nY32 + dh );
+ aPoly = tools::Polygon( aCenter, dw, dh );
+ }
else
- DrawPie( aRect, Point( nStartX, nStartY ), Point( nEndX, nEndY ) );
+ aPoly = tools::Polygon( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Pie );
+ aPoly.Optimize( PolyOptimizeFlags::EDGES );
+ DrawPolygon( aPoly, mbRecordPath );
}
break;
@@ -1388,14 +1394,6 @@ namespace emfio
}
break;
- case EMR_ARCTO :
- {
- sal_uInt32 nStartX, nStartY, nEndX, nEndY;
- mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY ).ReadUInt32( nEndX ).ReadUInt32( nEndY );
- DrawArc( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), true );
- }
- break;
-
case EMR_BEGINPATH :
{
ClearPath();