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 #include "core/fpdfapi/page/cpdf_path.h"
8
CPDF_Path()9 CPDF_Path::CPDF_Path() {}
10
CPDF_Path(const CPDF_Path & that)11 CPDF_Path::CPDF_Path(const CPDF_Path& that) : m_Ref(that.m_Ref) {}
12
~CPDF_Path()13 CPDF_Path::~CPDF_Path() {}
14
GetPoints() const15 const std::vector<FX_PATHPOINT>& CPDF_Path::GetPoints() const {
16 return m_Ref.GetObject()->GetPoints();
17 }
18
ClosePath()19 void CPDF_Path::ClosePath() {
20 m_Ref.GetPrivateCopy()->ClosePath();
21 }
22
GetPoint(int index) const23 CFX_PointF CPDF_Path::GetPoint(int index) const {
24 return m_Ref.GetObject()->GetPoint(index);
25 }
26
GetBoundingBox() const27 CFX_FloatRect CPDF_Path::GetBoundingBox() const {
28 return m_Ref.GetObject()->GetBoundingBox();
29 }
30
GetBoundingBox(float line_width,float miter_limit) const31 CFX_FloatRect CPDF_Path::GetBoundingBox(float line_width,
32 float miter_limit) const {
33 return m_Ref.GetObject()->GetBoundingBox(line_width, miter_limit);
34 }
35
IsRect() const36 bool CPDF_Path::IsRect() const {
37 return m_Ref.GetObject()->IsRect();
38 }
39
Transform(const CFX_Matrix * pMatrix)40 void CPDF_Path::Transform(const CFX_Matrix* pMatrix) {
41 m_Ref.GetPrivateCopy()->Transform(pMatrix);
42 }
43
Append(const CPDF_Path & other,const CFX_Matrix * pMatrix)44 void CPDF_Path::Append(const CPDF_Path& other, const CFX_Matrix* pMatrix) {
45 m_Ref.GetPrivateCopy()->Append(other.GetObject(), pMatrix);
46 }
47
Append(const CFX_PathData * pData,const CFX_Matrix * pMatrix)48 void CPDF_Path::Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix) {
49 m_Ref.GetPrivateCopy()->Append(pData, pMatrix);
50 }
51
AppendRect(float left,float bottom,float right,float top)52 void CPDF_Path::AppendRect(float left, float bottom, float right, float top) {
53 m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top);
54 }
55
AppendPoint(const CFX_PointF & point,FXPT_TYPE type,bool close)56 void CPDF_Path::AppendPoint(const CFX_PointF& point,
57 FXPT_TYPE type,
58 bool close) {
59 CFX_PathData data;
60 data.AppendPoint(point, type, close);
61 Append(&data, nullptr);
62 }
63