1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FPDFAPI_PAGE_CPDF_PATH_H_ 8 #define CORE_FPDFAPI_PAGE_CPDF_PATH_H_ 9 10 #include <vector> 11 12 #include "core/fxcrt/fx_system.h" 13 #include "core/fxcrt/shared_copy_on_write.h" 14 #include "core/fxge/cfx_pathdata.h" 15 16 class CPDF_Path { 17 public: 18 CPDF_Path(); 19 CPDF_Path(const CPDF_Path& that); 20 ~CPDF_Path(); 21 Emplace()22 void Emplace() { m_Ref.Emplace(); } HasRef()23 bool HasRef() const { return !!m_Ref; } 24 25 const std::vector<FX_PATHPOINT>& GetPoints() const; 26 void ClosePath(); 27 28 CFX_PointF GetPoint(int index) const; 29 CFX_FloatRect GetBoundingBox() const; 30 CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const; 31 32 bool IsRect() const; 33 void Transform(const CFX_Matrix& matrix); 34 35 void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); 36 void AppendFloatRect(const CFX_FloatRect& rect); 37 void AppendRect(float left, float bottom, float right, float top); 38 void AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close); 39 40 // TODO(tsepez): Remove when all access thru this class. GetObject()41 const CFX_PathData* GetObject() const { return m_Ref.GetObject(); } 42 43 private: 44 SharedCopyOnWrite<CFX_RetainablePathData> m_Ref; 45 }; 46 47 #endif // CORE_FPDFAPI_PAGE_CPDF_PATH_H_ 48