summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorBartosz Kosiorek <gang65@poczta.onet.pl>2021-06-14 12:50:19 +0200
committerBartosz Kosiorek <gang65@poczta.onet.pl>2021-06-17 18:24:57 +0200
commitbefa3f75fd7bf5ef35741d099ab18e94f10e4e1d (patch)
tree64a8b70f2d017f5080f494377c9e8435bf39a182 /drawinglayer
parent86df3a49f339a38d839f2ddedafa862031ca759d (diff)
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 <gang65@poczta.onet.pl>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/tools/emfphelperdata.cxx22
-rw-r--r--drawinglayer/source/tools/emfppath.cxx31
-rw-r--r--drawinglayer/source/tools/emfppath.hxx4
3 files changed, 27 insertions, 30 deletions
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;