| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" | 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" |
| 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return this; | 39 return this; |
| 40 } | 40 } |
| 41 | 41 |
| 42 const CPDF_Array* CPDF_Array::AsArray() const { | 42 const CPDF_Array* CPDF_Array::AsArray() const { |
| 43 return this; | 43 return this; |
| 44 } | 44 } |
| 45 | 45 |
| 46 CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const { | 46 CPDF_Object* CPDF_Array::Clone(FX_BOOL bDirect) const { |
| 47 CPDF_Array* pCopy = new CPDF_Array(); | 47 CPDF_Array* pCopy = new CPDF_Array(); |
| 48 for (size_t i = 0; i < GetCount(); i++) { | 48 for (size_t i = 0; i < GetCount(); i++) { |
| 49 CPDF_Object* value = m_Objects.at(i); | 49 CPDF_Object* pObj = m_Objects.at(i); |
| 50 pCopy->m_Objects.push_back(value->Clone(bDirect)); | 50 CPDF_Object* pCloneObj = pObj->Clone(bDirect); |
| 51 if (pCloneObj) |
| 52 pCopy->m_Objects.push_back(pCloneObj); |
| 51 } | 53 } |
| 52 return pCopy; | 54 return pCopy; |
| 53 } | 55 } |
| 54 | 56 |
| 55 CFX_FloatRect CPDF_Array::GetRect() { | 57 CFX_FloatRect CPDF_Array::GetRect() { |
| 56 CFX_FloatRect rect; | 58 CFX_FloatRect rect; |
| 57 if (!IsArray() || m_Objects.size() != 4) | 59 if (!IsArray() || m_Objects.size() != 4) |
| 58 return rect; | 60 return rect; |
| 59 | 61 |
| 60 rect.left = GetNumberAt(0); | 62 rect.left = GetNumberAt(0); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 ASSERT(IsArray()); | 199 ASSERT(IsArray()); |
| 198 CPDF_Number* pNumber = new CPDF_Number(f); | 200 CPDF_Number* pNumber = new CPDF_Number(f); |
| 199 Add(pNumber); | 201 Add(pNumber); |
| 200 } | 202 } |
| 201 | 203 |
| 202 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, | 204 void CPDF_Array::AddReference(CPDF_IndirectObjectHolder* pDoc, |
| 203 uint32_t objnum) { | 205 uint32_t objnum) { |
| 204 ASSERT(IsArray()); | 206 ASSERT(IsArray()); |
| 205 Add(new CPDF_Reference(pDoc, objnum)); | 207 Add(new CPDF_Reference(pDoc, objnum)); |
| 206 } | 208 } |
| OLD | NEW |