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_formobject.h" 8 9 #include <utility> 10 11 #include "core/fpdfapi/page/cpdf_form.h" 12 CPDF_FormObject(std::unique_ptr<CPDF_Form> pForm,const CFX_Matrix & matrix)13CPDF_FormObject::CPDF_FormObject(std::unique_ptr<CPDF_Form> pForm, 14 const CFX_Matrix& matrix) 15 : m_pForm(std::move(pForm)), m_FormMatrix(matrix) {} 16 ~CPDF_FormObject()17CPDF_FormObject::~CPDF_FormObject() {} 18 Transform(const CFX_Matrix & matrix)19void CPDF_FormObject::Transform(const CFX_Matrix& matrix) { 20 m_FormMatrix.Concat(matrix); 21 CalcBoundingBox(); 22 } 23 IsForm() const24bool CPDF_FormObject::IsForm() const { 25 return true; 26 } 27 AsForm()28CPDF_FormObject* CPDF_FormObject::AsForm() { 29 return this; 30 } 31 AsForm() const32const CPDF_FormObject* CPDF_FormObject::AsForm() const { 33 return this; 34 } 35 GetType() const36CPDF_PageObject::Type CPDF_FormObject::GetType() const { 37 return FORM; 38 } 39 CalcBoundingBox()40void CPDF_FormObject::CalcBoundingBox() { 41 CFX_FloatRect form_rect = 42 m_FormMatrix.TransformRect(m_pForm->CalcBoundingBox()); 43 m_Left = form_rect.left; 44 m_Bottom = form_rect.bottom; 45 m_Right = form_rect.right; 46 m_Top = form_rect.top; 47 } 48