Home | History | Annotate | Download | only in page
      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 
      9 CPDF_Path::CPDF_Path() {}
     10 
     11 CPDF_Path::CPDF_Path(const CPDF_Path& that) : m_Ref(that.m_Ref) {}
     12 
     13 CPDF_Path::~CPDF_Path() {}
     14 
     15 const std::vector<FX_PATHPOINT>& CPDF_Path::GetPoints() const {
     16   return m_Ref.GetObject()->GetPoints();
     17 }
     18 
     19 void CPDF_Path::ClosePath() {
     20   m_Ref.GetPrivateCopy()->ClosePath();
     21 }
     22 
     23 CFX_PointF CPDF_Path::GetPoint(int index) const {
     24   return m_Ref.GetObject()->GetPoint(index);
     25 }
     26 
     27 CFX_FloatRect CPDF_Path::GetBoundingBox() const {
     28   return m_Ref.GetObject()->GetBoundingBox();
     29 }
     30 
     31 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 
     36 bool CPDF_Path::IsRect() const {
     37   return m_Ref.GetObject()->IsRect();
     38 }
     39 
     40 void CPDF_Path::Transform(const CFX_Matrix* pMatrix) {
     41   m_Ref.GetPrivateCopy()->Transform(pMatrix);
     42 }
     43 
     44 void CPDF_Path::Append(const CPDF_Path& other, const CFX_Matrix* pMatrix) {
     45   m_Ref.GetPrivateCopy()->Append(other.GetObject(), pMatrix);
     46 }
     47 
     48 void CPDF_Path::Append(const CFX_PathData* pData, const CFX_Matrix* pMatrix) {
     49   m_Ref.GetPrivateCopy()->Append(pData, pMatrix);
     50 }
     51 
     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 
     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