summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/SVGSubpathData.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/rendering/svg/SVGSubpathData.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/rendering/svg/SVGSubpathData.h')
-rw-r--r--Source/WebCore/rendering/svg/SVGSubpathData.h67
1 files changed, 28 insertions, 39 deletions
diff --git a/Source/WebCore/rendering/svg/SVGSubpathData.h b/Source/WebCore/rendering/svg/SVGSubpathData.h
index cf7901d8d..073afd4ce 100644
--- a/Source/WebCore/rendering/svg/SVGSubpathData.h
+++ b/Source/WebCore/rendering/svg/SVGSubpathData.h
@@ -17,10 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef SVGSubpathData_h
-#define SVGSubpathData_h
+#pragma once
-#if ENABLE(SVG)
#include "Path.h"
#include <wtf/Vector.h>
@@ -30,51 +28,46 @@ class SVGSubpathData {
public:
SVGSubpathData(Vector<FloatPoint>& zeroLengthSubpathLocations)
: m_zeroLengthSubpathLocations(zeroLengthSubpathLocations)
- , m_haveSeenMoveOnly(true)
- , m_pathIsZeroLength(true)
{
- m_lastPoint.set(0, 0);
- m_movePoint.set(0, 0);
}
- static void updateFromPathElement(void* info, const PathElement* element)
+ static void updateFromPathElement(SVGSubpathData& subpathFinder, const PathElement& element)
{
- SVGSubpathData* subpathFinder = static_cast<SVGSubpathData*>(info);
- switch (element->type) {
+ switch (element.type) {
case PathElementMoveToPoint:
- if (subpathFinder->m_pathIsZeroLength && !subpathFinder->m_haveSeenMoveOnly)
- subpathFinder->m_zeroLengthSubpathLocations.append(subpathFinder->m_lastPoint);
- subpathFinder->m_lastPoint = subpathFinder->m_movePoint = element->points[0];
- subpathFinder->m_haveSeenMoveOnly = true;
- subpathFinder->m_pathIsZeroLength = true;
+ if (subpathFinder.m_pathIsZeroLength && !subpathFinder.m_haveSeenMoveOnly)
+ subpathFinder.m_zeroLengthSubpathLocations.append(subpathFinder.m_lastPoint);
+ subpathFinder.m_lastPoint = subpathFinder.m_movePoint = element.points[0];
+ subpathFinder.m_haveSeenMoveOnly = true;
+ subpathFinder.m_pathIsZeroLength = true;
break;
case PathElementAddLineToPoint:
- if (subpathFinder->m_lastPoint != element->points[0]) {
- subpathFinder->m_pathIsZeroLength = false;
- subpathFinder->m_lastPoint = element->points[0];
+ if (subpathFinder.m_lastPoint != element.points[0]) {
+ subpathFinder.m_pathIsZeroLength = false;
+ subpathFinder.m_lastPoint = element.points[0];
}
- subpathFinder->m_haveSeenMoveOnly = false;
+ subpathFinder.m_haveSeenMoveOnly = false;
break;
case PathElementAddQuadCurveToPoint:
- if (subpathFinder->m_lastPoint != element->points[0] || element->points[0] != element->points[1]) {
- subpathFinder->m_pathIsZeroLength = false;
- subpathFinder->m_lastPoint = element->points[1];
+ if (subpathFinder.m_lastPoint != element.points[0] || element.points[0] != element.points[1]) {
+ subpathFinder.m_pathIsZeroLength = false;
+ subpathFinder.m_lastPoint = element.points[1];
}
- subpathFinder->m_haveSeenMoveOnly = false;
+ subpathFinder.m_haveSeenMoveOnly = false;
break;
case PathElementAddCurveToPoint:
- if (subpathFinder->m_lastPoint != element->points[0] || element->points[0] != element->points[1] || element->points[1] != element->points[2]) {
- subpathFinder->m_pathIsZeroLength = false;
- subpathFinder->m_lastPoint = element->points[2];
+ if (subpathFinder.m_lastPoint != element.points[0] || element.points[0] != element.points[1] || element.points[1] != element.points[2]) {
+ subpathFinder.m_pathIsZeroLength = false;
+ subpathFinder.m_lastPoint = element.points[2];
}
- subpathFinder->m_haveSeenMoveOnly = false;
+ subpathFinder.m_haveSeenMoveOnly = false;
break;
case PathElementCloseSubpath:
- if (subpathFinder->m_pathIsZeroLength)
- subpathFinder->m_zeroLengthSubpathLocations.append(subpathFinder->m_lastPoint);
- subpathFinder->m_haveSeenMoveOnly = true; // This is an implicit move for the next element
- subpathFinder->m_pathIsZeroLength = true; // A new sub-path also starts here
- subpathFinder->m_lastPoint = subpathFinder->m_movePoint;
+ if (subpathFinder.m_pathIsZeroLength)
+ subpathFinder.m_zeroLengthSubpathLocations.append(subpathFinder.m_lastPoint);
+ subpathFinder.m_haveSeenMoveOnly = true; // This is an implicit move for the next element
+ subpathFinder.m_pathIsZeroLength = true; // A new sub-path also starts here
+ subpathFinder.m_lastPoint = subpathFinder.m_movePoint;
break;
}
}
@@ -89,12 +82,8 @@ private:
Vector<FloatPoint>& m_zeroLengthSubpathLocations;
FloatPoint m_lastPoint;
FloatPoint m_movePoint;
- bool m_haveSeenMoveOnly;
- bool m_pathIsZeroLength;
+ bool m_haveSeenMoveOnly { false };
+ bool m_pathIsZeroLength { false };
};
-}
-
-#endif // ENABLE(SVG)
-#endif // SVGSubpathData_h
-
+} // namespace WebCore