OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ |
8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ |
9 | 9 |
| 10 #include "core/fxcrt/include/cfx_count_ref.h" |
10 #include "core/fxcrt/include/fx_system.h" | 11 #include "core/fxcrt/include/fx_system.h" |
11 #include "core/fxge/include/cfx_fxgedevice.h" | 12 #include "core/fxge/include/cfx_fxgedevice.h" |
12 #include "core/fxge/include/cfx_pathdata.h" | 13 #include "core/fxge/include/cfx_pathdata.h" |
13 #include "core/fxge/include/cfx_renderdevice.h" | 14 #include "core/fxge/include/cfx_renderdevice.h" |
14 | 15 |
15 class CPDF_Path : public CFX_CountRef<CFX_PathData> { | 16 class CPDF_Path { |
16 public: | 17 public: |
17 int GetPointCount() const { return GetObject()->GetPointCount(); } | 18 CPDF_Path(); |
18 int GetFlag(int index) const { return GetObject()->GetFlag(index); } | 19 CPDF_Path(const CPDF_Path& that); |
19 FX_FLOAT GetPointX(int index) const { return GetObject()->GetPointX(index); } | 20 ~CPDF_Path(); |
20 FX_FLOAT GetPointY(int index) const { return GetObject()->GetPointY(index); } | |
21 FX_PATHPOINT* GetPoints() const { return GetObject()->GetPoints(); } | |
22 CFX_FloatRect GetBoundingBox() const { return GetObject()->GetBoundingBox(); } | |
23 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, | |
24 FX_FLOAT miter_limit) const { | |
25 return GetObject()->GetBoundingBox(line_width, miter_limit); | |
26 } | |
27 | 21 |
28 FX_BOOL IsRect() const { return GetObject()->IsRect(); } | 22 void Emplace() { m_Ref.Emplace(); } |
29 void Transform(const CFX_Matrix* pMatrix) { | 23 operator bool() const { return !!m_Ref; } |
30 GetPrivateCopy()->Transform(pMatrix); | |
31 } | |
32 void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix) { | |
33 GetPrivateCopy()->Append(other.GetObject(), pMatrix); | |
34 } | |
35 | 24 |
36 void AppendRect(FX_FLOAT left, | 25 int GetPointCount() const; |
37 FX_FLOAT bottom, | 26 void SetPointCount(int count); |
38 FX_FLOAT right, | 27 const FX_PATHPOINT* GetPoints() const; |
39 FX_FLOAT top) { | 28 FX_PATHPOINT* GetMutablePoints(); |
40 GetPrivateCopy()->AppendRect(left, bottom, right, top); | 29 |
41 } | 30 int GetFlag(int index) const; |
| 31 FX_FLOAT GetPointX(int index) const; |
| 32 FX_FLOAT GetPointY(int index) const; |
| 33 CFX_FloatRect GetBoundingBox() const; |
| 34 CFX_FloatRect GetBoundingBox(FX_FLOAT line_width, FX_FLOAT miter_limit) const; |
| 35 |
| 36 FX_BOOL IsRect() const; |
| 37 void Transform(const CFX_Matrix* pMatrix); |
| 38 |
| 39 void Append(const CPDF_Path& other, const CFX_Matrix* pMatrix); |
| 40 void Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix); |
| 41 void AppendRect(FX_FLOAT left, FX_FLOAT bottom, FX_FLOAT right, FX_FLOAT top); |
| 42 |
| 43 // TODO(tsepez): Remove when all access thru this class. |
| 44 const CFX_PathData* GetObject() const { return m_Ref.GetObject(); } |
| 45 |
| 46 private: |
| 47 CFX_CountRef<CFX_PathData> m_Ref; |
42 }; | 48 }; |
43 | 49 |
44 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ | 50 #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_ |
OLD | NEW |