diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-15 11:07:32 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-15 17:47:57 +0000 |
commit | e4602321f3175fa5addb6761d0e94f5c2fc93d0c (patch) | |
tree | 6671774659645fad6d9ce55a5910b4665a25094f /core/fxge/cfx_pathdata.h | |
parent | eb55885e9a9eec670ed98cbd12dc96d63e6a6623 (diff) | |
download | pdfium-e4602321f3175fa5addb6761d0e94f5c2fc93d0c.tar.xz |
Cleanup CFX_PathData.
This CL replaces the array of path points with a vector. Cleaning up the usage
as required.
Change-Id: Ifa386a2c847005fef68af748ebe99c4e08961238
Reviewed-on: https://pdfium-review.googlesource.com/2710
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxge/cfx_pathdata.h')
-rw-r--r-- | core/fxge/cfx_pathdata.h | 38 |
1 files changed, 18 insertions, 20 deletions
diff --git a/core/fxge/cfx_pathdata.h b/core/fxge/cfx_pathdata.h index 46fdfeb740..7d5e6e28c6 100644 --- a/core/fxge/cfx_pathdata.h +++ b/core/fxge/cfx_pathdata.h @@ -7,6 +7,8 @@ #ifndef CORE_FXGE_CFX_PATHDATA_H_ #define CORE_FXGE_CFX_PATHDATA_H_ +#include <vector> + #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" #include "core/fxge/cfx_renderdevice.h" @@ -28,41 +30,37 @@ class CFX_PathData { CFX_PathData(const CFX_PathData& src); ~CFX_PathData(); - int GetPointCount() const { return m_PointCount; } - FXPT_TYPE GetType(int index) const { return m_pPoints[index].m_Type; } + void Clear(); + + FXPT_TYPE GetType(int index) const { return m_Points[index].m_Type; } bool IsClosingFigure(int index) const { - return m_pPoints[index].m_CloseFigure; + return m_Points[index].m_CloseFigure; } - FX_FLOAT GetPointX(int index) const { return m_pPoints[index].m_PointX; } - FX_FLOAT GetPointY(int index) const { return m_pPoints[index].m_PointY; } - FX_PATHPOINT* GetPoints() const { return m_pPoints; } - void SetPointCount(int nPoints); - void AllocPointCount(int nPoints); - void AddPointCount(int addPoints); + FX_FLOAT GetPointX(int index) const { return m_Points[index].m_PointX; } + FX_FLOAT GetPointY(int index) const { return m_Points[index].m_PointY; } + const std::vector<FX_PATHPOINT>& GetPoints() const { return m_Points; } + std::vector<FX_PATHPOINT>& GetPoints() { return m_Points; } + CFX_FloatRect GetBoundingBox() const; CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; + void Transform(const CFX_Matrix* pMatrix); bool IsRect() const; - bool GetZeroAreaPath(CFX_PathData& NewPath, + bool GetZeroAreaPath(CFX_PathData* NewPath, CFX_Matrix* pMatrix, bool& bThin, bool bAdjust) const; bool IsRect(const CFX_Matrix* pMatrix, CFX_FloatRect* rect) const; + + void Append(const CFX_PathData& data); void Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix); void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); - void SetPoint(int index, - FX_FLOAT x, - FX_FLOAT y, - FXPT_TYPE type, - bool closeFigure); - void TrimPoints(int nPoints); - void Copy(const CFX_PathData& src); + void AppendPoint(FX_FLOAT x, FX_FLOAT y, FXPT_TYPE type, bool closeFigure); + void ClosePath(); private: - int m_PointCount; - int m_AllocCount; - FX_PATHPOINT* m_pPoints; + std::vector<FX_PATHPOINT> m_Points; }; #endif // CORE_FXGE_CFX_PATHDATA_H_ |