summaryrefslogtreecommitdiff
path: root/emfio
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-22 19:19:12 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2021-05-22 20:08:11 +0200
commit4f4c5b43f0c69385aa2738cbac7f7c898af1972f (patch)
tree30c51f4194f1a7f0853340057574c107f19c81de /emfio
parent90818a8704daece65fad2e41aed0fc17e5a8cf13 (diff)
tdf#55007 EMF Allow negatives values for Start Point and End Point
With previous inplementation, the ARC, ARCTO, CHORD and PIE records were get Start Point and End Point only with positive values. It was causing display issues. This patch fix that according to [MS-EMF] specification Change-Id: Ie1d90a904e840674380b81af0dfe21260374587d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115994 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'emfio')
-rw-r--r--emfio/inc/emfreader.hxx2
-rw-r--r--emfio/source/reader/emfreader.cxx17
2 files changed, 6 insertions, 13 deletions
diff --git a/emfio/inc/emfreader.hxx b/emfio/inc/emfreader.hxx
index e580835fc083..a09ad6fa2c20 100644
--- a/emfio/inc/emfreader.hxx
+++ b/emfio/inc/emfreader.hxx
@@ -27,7 +27,7 @@ namespace emfio
class EmfReader : public MtfTools
{
private:
- sal_Int32 mnRecordCount;
+ sal_uInt32 mnRecordCount;
bool mbRecordPath : 1;
bool mbEMFPlus : 1;
diff --git a/emfio/source/reader/emfreader.cxx b/emfio/source/reader/emfreader.cxx
index e9a3afec3f19..9a8784c7e631 100644
--- a/emfio/source/reader/emfreader.cxx
+++ b/emfio/source/reader/emfreader.cxx
@@ -1369,8 +1369,8 @@ namespace emfio
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 );
+ sal_Int32 nStartX, nStartY, nEndX, nEndY;
+ mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadInt32( nStartX ).ReadInt32( nStartY ).ReadInt32( nEndX ).ReadInt32( nEndY );
SAL_INFO( "emfio", "\t\t Bounds: " << nX32 << ":" << nY32 << ", " << nx32 << ":" << ny32 << ", Start: " << nStartX << ":" << nStartY << ", End: " << nEndX << ":" << nEndY );
tools::Polygon aPoly( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Arc );
if ( nRecType == EMR_CHORD )
@@ -1382,8 +1382,8 @@ namespace emfio
case EMR_PIE :
{
- sal_uInt32 nStartX, nStartY, nEndX, nEndY;
- mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadUInt32( nStartX ).ReadUInt32( nStartY ).ReadUInt32( nEndX ).ReadUInt32( nEndY );
+ sal_Int32 nStartX, nStartY, nEndX, nEndY;
+ mpInputStream->ReadInt32( nX32 ).ReadInt32( nY32 ).ReadInt32( nx32 ).ReadInt32( ny32 ).ReadInt32( nStartX ).ReadInt32( nStartY ).ReadInt32( nEndX ).ReadInt32( nEndY );
tools::Polygon aPoly( ReadRectangle( nX32, nY32, nx32, ny32 ), Point( nStartX, nStartY ), Point( nEndX, nEndY ), PolyStyle::Pie );
DrawPolygon( aPoly, mbRecordPath );
}
@@ -2153,16 +2153,9 @@ namespace emfio
mnEndPos = nActualFileSize;
}
- mpInputStream->ReadInt32(mnRecordCount);
+ mpInputStream->ReadUInt32(mnRecordCount);
SAL_INFO("emfio", "\tRecords: " << mnRecordCount);
- if (mnRecordCount <= 0)
- {
- SAL_WARN("emfio", "EMF\t\tEMF Header object shows record counter as <= 0! This shouldn't "
- "be possible... indicator of possible file corruption?");
- return false;
- }
-
// the number of "handles", or graphics objects used in the metafile
sal_uInt16 nHandlesCount;