1 // Copyright 2016 The PDFium Authors 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/shared_copy_on_write.h" 13 #include "core/fxge/cfx_path.h" 14 15 class CPDF_Path { 16 public: 17 CPDF_Path(); 18 CPDF_Path(const CPDF_Path& that); 19 ~CPDF_Path(); 20 Emplace()21 void Emplace() { m_Ref.Emplace(); } HasRef()22 bool HasRef() const { return !!m_Ref; } 23 24 const std::vector<CFX_Path::Point>& GetPoints() const; 25 void ClosePath(); 26 27 CFX_PointF GetPoint(int index) const; 28 CFX_FloatRect GetBoundingBox() const; 29 CFX_FloatRect GetBoundingBoxForStrokePath(float line_width, 30 float miter_limit) const; 31 32 bool IsRect() const; 33 void Transform(const CFX_Matrix& matrix); 34 35 void Append(const CFX_Path& path, 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, CFX_Path::Point::Type type); 39 void AppendPointAndClose(const CFX_PointF& point, CFX_Path::Point::Type type); 40 41 // TODO(tsepez): Remove when all access thru this class. GetObject()42 const CFX_Path* GetObject() const { return m_Ref.GetObject(); } 43 44 private: 45 SharedCopyOnWrite<CFX_RetainablePath> m_Ref; 46 }; 47 48 #endif // CORE_FPDFAPI_PAGE_CPDF_PATH_H_ 49