• 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_pageobject.h"
8 
CPDF_PageObject(int32_t content_stream)9 CPDF_PageObject::CPDF_PageObject(int32_t content_stream)
10     : m_ContentStream(content_stream) {}
11 
12 CPDF_PageObject::~CPDF_PageObject() = default;
13 
IsText() const14 bool CPDF_PageObject::IsText() const {
15   return false;
16 }
17 
IsPath() const18 bool CPDF_PageObject::IsPath() const {
19   return false;
20 }
21 
IsImage() const22 bool CPDF_PageObject::IsImage() const {
23   return false;
24 }
25 
IsShading() const26 bool CPDF_PageObject::IsShading() const {
27   return false;
28 }
29 
IsForm() const30 bool CPDF_PageObject::IsForm() const {
31   return false;
32 }
33 
AsText()34 CPDF_TextObject* CPDF_PageObject::AsText() {
35   return nullptr;
36 }
37 
AsText() const38 const CPDF_TextObject* CPDF_PageObject::AsText() const {
39   return nullptr;
40 }
41 
AsPath()42 CPDF_PathObject* CPDF_PageObject::AsPath() {
43   return nullptr;
44 }
45 
AsPath() const46 const CPDF_PathObject* CPDF_PageObject::AsPath() const {
47   return nullptr;
48 }
49 
AsImage()50 CPDF_ImageObject* CPDF_PageObject::AsImage() {
51   return nullptr;
52 }
53 
AsImage() const54 const CPDF_ImageObject* CPDF_PageObject::AsImage() const {
55   return nullptr;
56 }
57 
AsShading()58 CPDF_ShadingObject* CPDF_PageObject::AsShading() {
59   return nullptr;
60 }
61 
AsShading() const62 const CPDF_ShadingObject* CPDF_PageObject::AsShading() const {
63   return nullptr;
64 }
65 
AsForm()66 CPDF_FormObject* CPDF_PageObject::AsForm() {
67   return nullptr;
68 }
69 
AsForm() const70 const CPDF_FormObject* CPDF_PageObject::AsForm() const {
71   return nullptr;
72 }
73 
CopyData(const CPDF_PageObject * pSrc)74 void CPDF_PageObject::CopyData(const CPDF_PageObject* pSrc) {
75   CopyStates(*pSrc);
76   m_Rect = pSrc->m_Rect;
77   m_bDirty = true;
78 }
79 
TransformClipPath(const CFX_Matrix & matrix)80 void CPDF_PageObject::TransformClipPath(const CFX_Matrix& matrix) {
81   if (!m_ClipPath.HasRef())
82     return;
83   m_ClipPath.Transform(matrix);
84   SetDirty(true);
85 }
86 
TransformGeneralState(const CFX_Matrix & matrix)87 void CPDF_PageObject::TransformGeneralState(const CFX_Matrix& matrix) {
88   if (!m_GeneralState.HasRef())
89     return;
90   m_GeneralState.GetMutableMatrix()->Concat(matrix);
91   SetDirty(true);
92 }
93 
GetBBox() const94 FX_RECT CPDF_PageObject::GetBBox() const {
95   return GetRect().GetOuterRect();
96 }
97 
GetTransformedBBox(const CFX_Matrix & matrix) const98 FX_RECT CPDF_PageObject::GetTransformedBBox(const CFX_Matrix& matrix) const {
99   return matrix.TransformRect(GetRect()).GetOuterRect();
100 }
101