diff options
author | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-05-06 17:43:57 +0200 |
---|---|---|
committer | Bartosz Kosiorek <gang65@poczta.onet.pl> | 2021-05-06 20:59:19 +0200 |
commit | 6bf2239a189423d087b2536dd7054b21df58ddc4 (patch) | |
tree | e176c4f2e4f693831339106b1f01c13180d391d3 /emfio/source | |
parent | ef5b56123701b62b7fabeb1d1d9a7d1a4aa00d97 (diff) |
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>
Diffstat (limited to 'emfio/source')
-rw-r--r-- | emfio/source/reader/emfreader.cxx | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx index 3f1945bf35a5..96c935a0c74c 100644 --- a/emfio/source/reader/emfreader.cxx +++ b/emfio/source/reader/emfreader.cxx @@ -1367,18 +1367,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; @@ -1386,14 +1385,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; @@ -1404,14 +1410,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(); |