diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-02-23 13:29:56 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-23 18:52:03 +0000 |
commit | efcf362b6658346ae0f8f3cdb73d871fdd82c8af (patch) | |
tree | 035759c5ba63c89600b5c9e88a2c3120de0e6ff9 /xfa/fxgraphics/cfx_path.h | |
parent | c6dc69fb69e5d9974aa451d590194d568b78131b (diff) | |
download | pdfium-efcf362b6658346ae0f8f3cdb73d871fdd82c8af.tar.xz |
Merge CFX_PathGenerator into CFX_Path.
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 <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxgraphics/cfx_path.h')
-rw-r--r-- | xfa/fxgraphics/cfx_path.h | 78 |
1 files changed, 36 insertions, 42 deletions
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 <memory> - #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<CFX_PathGenerator> 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_ |