• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_defaultrenderdevice.h"
15 #include "core/fxge/cfx_pathdata.h"
16 #include "core/fxge/cfx_renderdevice.h"
17 
18 class CPDF_Path {
19  public:
20   CPDF_Path();
21   CPDF_Path(const CPDF_Path& that);
22   ~CPDF_Path();
23 
Emplace()24   void Emplace() { m_Ref.Emplace(); }
HasRef()25   bool HasRef() const { return !!m_Ref; }
26 
27   const std::vector<FX_PATHPOINT>& GetPoints() const;
28   void ClosePath();
29 
30   CFX_PointF GetPoint(int index) const;
31   CFX_FloatRect GetBoundingBox() const;
32   CFX_FloatRect GetBoundingBox(float line_width, float miter_limit) const;
33 
34   bool IsRect() const;
35   void Transform(const CFX_Matrix* pMatrix);
36 
37   void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix);
38   void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix);
39   void AppendRect(float left, float bottom, float right, float top);
40   void AppendPoint(const CFX_PointF& point, FXPT_TYPE type, bool close);
41 
42   // TODO(tsepez): Remove when all access thru this class.
GetObject()43   const CFX_PathData* GetObject() const { return m_Ref.GetObject(); }
44 
45  private:
46   SharedCopyOnWrite<CFX_PathData> m_Ref;
47 };
48 
49 #endif  // CORE_FPDFAPI_PAGE_CPDF_PATH_H_
50