From efcf362b6658346ae0f8f3cdb73d871fdd82c8af Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 23 Feb 2017 13:29:56 -0500 Subject: Merge CFX_PathGenerator into CFX_Path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CFX_Path was the only user of the CFX_PathGenerator which in turn just proxied to the CFX_PathData. This CL removes the CFX_PathGenerator and merges the code up into CFX_Path. Change-Id: I9e1a3921c987830f29b2ff5bd4aceacd2082e8f0 Reviewed-on: https://pdfium-review.googlesource.com/2825 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fxgraphics/cfx_path.h | 78 ++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 42 deletions(-) (limited to 'xfa/fxgraphics/cfx_path.h') diff --git a/xfa/fxgraphics/cfx_path.h b/xfa/fxgraphics/cfx_path.h index 1dee566788..267831603a 100644 --- a/xfa/fxgraphics/cfx_path.h +++ b/xfa/fxgraphics/cfx_path.h @@ -7,58 +7,52 @@ #ifndef XFA_FXGRAPHICS_CFX_PATH_H_ #define XFA_FXGRAPHICS_CFX_PATH_H_ -#include - #include "core/fxcrt/fx_system.h" +#include "core/fxge/cfx_pathdata.h" #include "xfa/fxgraphics/cfx_graphics.h" -class CFX_PathData; -class CFX_PathGenerator; - class CFX_Path final { public: CFX_Path(); ~CFX_Path(); - FWL_Error Create(); - FWL_Error MoveTo(const CFX_PointF& point); - FWL_Error LineTo(const CFX_PointF& point); - FWL_Error BezierTo(const CFX_PointF& c1, - const CFX_PointF& c2, - const CFX_PointF& to); - FWL_Error ArcTo(const CFX_PointF& pos, - const CFX_SizeF& size, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FWL_Error Close(); - - FWL_Error AddLine(const CFX_PointF& p1, const CFX_PointF& p2); - FWL_Error AddBezier(const CFX_PointF& p1, - const CFX_PointF& c1, - const CFX_PointF& c2, - const CFX_PointF& p2); - FWL_Error AddRectangle(FX_FLOAT left, - FX_FLOAT top, - FX_FLOAT width, - FX_FLOAT height); - FWL_Error AddEllipse(const CFX_PointF& pos, const CFX_SizeF& size); - FWL_Error AddEllipse(const CFX_RectF& rect); - FWL_Error AddArc(const CFX_PointF& pos, - const CFX_SizeF& size, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FWL_Error AddPie(const CFX_PointF& pos, - const CFX_SizeF& size, - FX_FLOAT startAngle, - FX_FLOAT sweepAngle); - FWL_Error AddSubpath(CFX_Path* path); - FWL_Error Clear(); - - bool IsEmpty() const; - CFX_PathData* GetPathData() const; + const CFX_PathData* GetPathData() const { return &data_; } + + void Clear(); + bool IsEmpty() const { return data_.GetPoints().empty(); } + void TransformBy(const CFX_Matrix& mt); + + void Close(); + void MoveTo(const CFX_PointF& point); + void LineTo(const CFX_PointF& point); + void BezierTo(const CFX_PointF& c1, + const CFX_PointF& c2, + const CFX_PointF& to); + void ArcTo(const CFX_PointF& pos, + const CFX_SizeF& size, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle); + + void AddLine(const CFX_PointF& p1, const CFX_PointF& p2); + void AddRectangle(FX_FLOAT left, + FX_FLOAT top, + FX_FLOAT width, + FX_FLOAT height); + void AddEllipse(const CFX_RectF& rect); + void AddArc(const CFX_PointF& pos, + const CFX_SizeF& size, + FX_FLOAT startAngle, + FX_FLOAT sweepAngle); + + void AddSubpath(CFX_Path* path); private: - std::unique_ptr m_generator; + void ArcToInternal(const CFX_PointF& pos, + const CFX_SizeF& size, + FX_FLOAT start_angle, + FX_FLOAT sweep_angle); + + CFX_PathData data_; }; #endif // XFA_FXGRAPHICS_CFX_PATH_H_ -- cgit v1.2.3