• 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 #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(FX_FLOAT line_width,FX_FLOAT miter_limit) const31 CFX_FloatRect CPDF_Path::GetBoundingBox(FX_FLOAT line_width,
32                                         FX_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(FX_FLOAT left,FX_FLOAT bottom,FX_FLOAT right,FX_FLOAT top)52 void CPDF_Path::AppendRect(FX_FLOAT left,
53                            FX_FLOAT bottom,
54                            FX_FLOAT right,
55                            FX_FLOAT top) {
56   m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top);
57 }
58 
AppendPoint(const CFX_PointF & point,FXPT_TYPE type,bool close)59 void CPDF_Path::AppendPoint(const CFX_PointF& point,
60                             FXPT_TYPE type,
61                             bool close) {
62   CFX_PathData data;
63   data.AppendPoint(point, type, close);
64   Append(&data, nullptr);
65 }
66