drawinglayer/source/tools/emfphelperdata.cxx | 22 ++++++++----------- drawinglayer/source/tools/emfppath.cxx | 31 +++++++++++++-------------- drawinglayer/source/tools/emfppath.hxx | 4 +-- emfio/source/reader/wmfreader.cxx | 10 ++++++-- 4 files changed, 34 insertions(+), 33 deletions(-)
New commits: commit befa3f75fd7bf5ef35741d099ab18e94f10e4e1d Author: Bartosz Kosiorek <gan...@poczta.onet.pl> AuthorDate: Mon Jun 14 12:50:19 2021 +0200 Commit: Bartosz Kosiorek <gan...@poczta.onet.pl> CommitDate: Thu Jun 17 18:24:57 2021 +0200 EMF+ WMF Update the variable names and add additional TODO warnings Change-Id: I78b05fe3c293494195bdd37c3030147b1f21228e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117148 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gan...@poczta.onet.pl> diff --git a/drawinglayer/source/tools/emfphelperdata.cxx b/drawinglayer/source/tools/emfphelperdata.cxx index 1f3143112320..b56e51000211 100644 --- a/drawinglayer/source/tools/emfphelperdata.cxx +++ b/drawinglayer/source/tools/emfphelperdata.cxx @@ -281,16 +281,15 @@ namespace emfplushelper } case EmfPlusObjectTypePath: { - sal_uInt32 header, pathFlags; - sal_Int32 points; - - rObjectStream.ReadUInt32(header).ReadInt32(points).ReadUInt32(pathFlags); - SAL_INFO("drawinglayer.emf", "EMF+\t\tHeader: 0x" << std::hex << header); - SAL_INFO("drawinglayer.emf", "EMF+\t\tPoints: " << std::dec << points); - SAL_INFO("drawinglayer.emf", "EMF+\t\tAdditional flags: 0x" << std::hex << pathFlags << std::dec); - EMFPPath *path = new EMFPPath(points); + sal_uInt32 aVersion, aPathPointCount, aPathPointFlags; + + rObjectStream.ReadUInt32(aVersion).ReadUInt32(aPathPointCount).ReadUInt32(aPathPointFlags); + SAL_INFO("drawinglayer.emf", "EMF+\t\tVersion: 0x" << std::hex << aVersion); + SAL_INFO("drawinglayer.emf", "EMF+\t\tNumber of points: " << std::dec << aPathPointCount); + SAL_INFO("drawinglayer.emf", "EMF+\t\tPath point flags: 0x" << std::hex << aPathPointFlags << std::dec); + EMFPPath *path = new EMFPPath(aPathPointCount); maEMFPObjects[index].reset(path); - path->Read(rObjectStream, pathFlags); + path->Read(rObjectStream, aPathPointFlags); break; } case EmfPlusObjectTypeRegion: @@ -1336,11 +1335,10 @@ namespace emfplushelper case EmfPlusRecordTypeFillPolygon: { const sal_uInt8 index = flags & 0xff; - sal_uInt32 brushIndexOrColor; - sal_Int32 points; + sal_uInt32 brushIndexOrColor, points; rMS.ReadUInt32(brushIndexOrColor); - rMS.ReadInt32(points); + rMS.ReadUInt32(points); SAL_INFO("drawinglayer.emf", "EMF+\t FillPolygon in slot: " << index << " points: " << points); SAL_INFO("drawinglayer.emf", "EMF+\t " << ((flags & 0x8000) ? "Color" : "Brush index") << " : 0x" << std::hex << brushIndexOrColor << std::dec); diff --git a/drawinglayer/source/tools/emfppath.cxx b/drawinglayer/source/tools/emfppath.cxx index bfb92e0bd4a7..4da379004fba 100644 --- a/drawinglayer/source/tools/emfppath.cxx +++ b/drawinglayer/source/tools/emfppath.cxx @@ -58,11 +58,11 @@ namespace emfplushelper return static_cast<sal_Int16>(nRet); } - EMFPPath::EMFPPath (sal_Int32 _nPoints, bool bLines) + EMFPPath::EMFPPath (sal_uInt32 _nPoints, bool bLines) { - if (_nPoints<0 || o3tl::make_unsigned(_nPoints)>SAL_MAX_INT32 / (2 * sizeof(float))) + if (_nPoints > SAL_MAX_UINT32 / (2 * sizeof(float))) { - _nPoints = SAL_MAX_INT32 / (2 * sizeof(float)); + _nPoints = SAL_MAX_UINT32 / (2 * sizeof(float)); } nPoints = _nPoints; @@ -78,7 +78,7 @@ namespace emfplushelper void EMFPPath::Read (SvStream& s, sal_uInt32 pathFlags) { - for (int i = 0; i < nPoints; i ++) + for (sal_uInt32 i = 0; i < nPoints; i ++) { if (pathFlags & 0x800) { @@ -89,7 +89,7 @@ namespace emfplushelper sal_Int32 y = GetEmfPlusInteger(s); pPoints [i*2] = x; pPoints [i*2 + 1] = y; - SAL_INFO("drawinglayer.emf", "EMF+\t\t\tEmfPlusPointR [x,y]: " << x << ", " << y); + SAL_INFO("drawinglayer.emf", "EMF+\t\t\t" << i << ". EmfPlusPointR [x,y]: " << x << ", " << y); } else if (pathFlags & 0x4000) { @@ -97,7 +97,7 @@ namespace emfplushelper sal_Int16 x, y; s.ReadInt16( x ).ReadInt16( y ); - SAL_INFO ("drawinglayer.emf", "EMF+\t\t\tEmfPlusPoint [x,y]: " << x << "," << y); + SAL_INFO ("drawinglayer.emf", "EMF+\t\t\t" << i << ". EmfPlusPoint [x,y]: " << x << ", " << y); pPoints [i*2] = x; pPoints [i*2 + 1] = y; } @@ -105,16 +105,16 @@ namespace emfplushelper { // EMFPlusPointF: stored in Single (float) format s.ReadFloat( pPoints [i*2] ).ReadFloat( pPoints [i*2 + 1] ); - SAL_INFO ("drawinglayer.emf", "EMF+\t EMFPlusPointF [x,y]: " << pPoints [i*2] << "," << pPoints [i*2 + 1]); + SAL_INFO("drawinglayer.emf", "EMF+\t" << i << ". EMFPlusPointF [x,y]: " << pPoints [i * 2] << ", " << pPoints [i * 2 + 1]); } } if (pPointTypes) { - for (int i = 0; i < nPoints; i++) + for (sal_uInt32 i = 0; i < nPoints; i++) { s.ReadUChar(pPointTypes[i]); - SAL_INFO("drawinglayer.emf", "EMF+\tpoint type: " << static_cast<int>(pPointTypes[i])); + SAL_INFO("drawinglayer.emf", "EMF+\tpoint type: 0x" << std::hex << static_cast<int>(pPointTypes[i]) << std::dec); } } @@ -125,11 +125,11 @@ namespace emfplushelper { ::basegfx::B2DPolygon polygon; aPolygon.clear (); - int last_normal = 0, p = 0; + sal_uInt32 last_normal = 0, p = 0; ::basegfx::B2DPoint prev, mapped; bool hasPrev = false; - for (int i = 0; i < nPoints; i ++) + for (sal_uInt32 i = 0; i < nPoints; i ++) { if (p && pPointTypes && (pPointTypes [i] == 0)) { @@ -168,20 +168,19 @@ namespace emfplushelper } polygon.append (mapped); - SAL_INFO ("drawinglayer.emf", "EMF+\t\tPolygon append point: " << pPoints [i*2] << "," << pPoints [i*2 + 1] << " mapped: " << mapped.getX () << ":" << mapped.getY ()); + SAL_INFO ("drawinglayer.emf", "EMF+\t\tPoint: " << pPoints [i*2] << "," << pPoints [i*2 + 1] << " mapped: " << mapped.getX () << ":" << mapped.getY ()); if (hasPrev) { polygon.setPrevControlPoint (p, prev); - SAL_INFO ("drawinglayer.emf", "EMF+\t\tPolygon append prev: " << p << " mapped: " << prev.getX () << "," << prev.getY ()); + SAL_INFO ("drawinglayer.emf", "EMF+\t\tPolygon append prev: " << p << " mapped: " << prev.getX () << "," << prev.getY ()); hasPrev = false; } - p ++; + p++; - if (pPointTypes && (pPointTypes [i] & 0x80)) + if (pPointTypes && (pPointTypes [i] & 0x80)) // closed polygon { - // closed polygon polygon.setClosed (true); aPolygon.append (polygon); SAL_INFO ("drawinglayer.emf", "EMF+\t\tClose polygon"); diff --git a/drawinglayer/source/tools/emfppath.hxx b/drawinglayer/source/tools/emfppath.hxx index e3357e59dbec..8db095a21a69 100644 --- a/drawinglayer/source/tools/emfppath.hxx +++ b/drawinglayer/source/tools/emfppath.hxx @@ -26,11 +26,11 @@ namespace emfplushelper struct EMFPPath : public EMFPObject { ::basegfx::B2DPolyPolygon aPolygon; - sal_Int32 nPoints; + sal_uInt32 nPoints; std::unique_ptr<float[]> pPoints; std::unique_ptr<sal_uInt8[]> pPointTypes; - EMFPPath(sal_Int32 _nPoints, bool bLines = false); + EMFPPath(sal_uInt32 _nPoints, bool bLines = false); virtual ~EMFPPath() override; diff --git a/emfio/source/reader/wmfreader.cxx b/emfio/source/reader/wmfreader.cxx index 9ddb674b7c05..4f5606f66aae 100644 --- a/emfio/source/reader/wmfreader.cxx +++ b/emfio/source/reader/wmfreader.cxx @@ -997,12 +997,14 @@ namespace emfio case W_META_CREATEBRUSH: { + SAL_WARN( "emfio", "TODO: Not implemented. Please fill the bug report" ); CreateObject(std::make_unique<WinMtfFillStyle>( COL_WHITE, false )); } break; case W_META_CREATEPATTERNBRUSH: { + SAL_WARN( "emfio", "TODO: Not implemented. Please fill the bug report" ); CreateObject(std::make_unique<WinMtfFillStyle>( COL_WHITE, false )); } break; @@ -1086,9 +1088,10 @@ namespace emfio case W_META_CREATEBRUSHINDIRECT: { - sal_uInt16 nStyle = 0; - mpInputStream->ReadUInt16( nStyle ); - CreateObject(std::make_unique<WinMtfFillStyle>( ReadColor(), ( nStyle == BS_HOLLOW ) )); + sal_uInt16 nBrushStyle = 0; + mpInputStream->ReadUInt16( nBrushStyle ); + CreateObject(std::make_unique<WinMtfFillStyle>( ReadColor(), ( nBrushStyle == BS_NULL ) )); + SAL_WARN_IF( (nBrushStyle != BS_SOLID) && (nBrushStyle != BS_NULL), "emfio", "TODO: Brush style not implemented. Please fill the bug report" ); } break; @@ -1159,6 +1162,7 @@ namespace emfio case W_META_EXCLUDECLIPRECT : { + SAL_WARN( "emfio", "TODO: Not working correctly. Please fill the bug report" ); ExcludeClipRect( ReadRectangle() ); } break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits