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(float line_width,
     32                                         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(float left, float bottom, float right, float top) {
     53   m_Ref.GetPrivateCopy()->AppendRect(left, bottom, right, top);
     54 }
     55 
     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