OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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/include/fpdfapi/fpdf_parser.h" | 7 #include "core/include/fpdfapi/fpdf_parser.h" |
8 | 8 |
9 #include "core/include/fxcrt/fx_string.h" | 9 #include "core/include/fxcrt/fx_string.h" |
10 | 10 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 CFX_FloatRect rect; | 433 CFX_FloatRect rect; |
434 if (!IsArray() || m_Objects.GetSize() != 4) | 434 if (!IsArray() || m_Objects.GetSize() != 4) |
435 return rect; | 435 return rect; |
436 | 436 |
437 rect.left = GetNumber(0); | 437 rect.left = GetNumber(0); |
438 rect.bottom = GetNumber(1); | 438 rect.bottom = GetNumber(1); |
439 rect.right = GetNumber(2); | 439 rect.right = GetNumber(2); |
440 rect.top = GetNumber(3); | 440 rect.top = GetNumber(3); |
441 return rect; | 441 return rect; |
442 } | 442 } |
443 CFX_AffineMatrix CPDF_Array::GetMatrix() { | 443 CFX_Matrix CPDF_Array::GetMatrix() { |
444 CFX_AffineMatrix matrix; | 444 CFX_Matrix matrix; |
445 if (!IsArray() || m_Objects.GetSize() != 6) | 445 if (!IsArray() || m_Objects.GetSize() != 6) |
446 return matrix; | 446 return matrix; |
447 | 447 |
448 matrix.Set(GetNumber(0), GetNumber(1), GetNumber(2), GetNumber(3), | 448 matrix.Set(GetNumber(0), GetNumber(1), GetNumber(2), GetNumber(3), |
449 GetNumber(4), GetNumber(5)); | 449 GetNumber(4), GetNumber(5)); |
450 return matrix; | 450 return matrix; |
451 } | 451 } |
452 CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { | 452 CPDF_Object* CPDF_Array::GetElement(FX_DWORD i) const { |
453 if (i >= (FX_DWORD)m_Objects.GetSize()) | 453 if (i >= (FX_DWORD)m_Objects.GetSize()) |
454 return nullptr; | 454 return nullptr; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { | 695 CPDF_Stream* CPDF_Dictionary::GetStream(const CFX_ByteStringC& key) const { |
696 return ToStream(GetElementValue(key)); | 696 return ToStream(GetElementValue(key)); |
697 } | 697 } |
698 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { | 698 CFX_FloatRect CPDF_Dictionary::GetRect(const CFX_ByteStringC& key) const { |
699 CFX_FloatRect rect; | 699 CFX_FloatRect rect; |
700 CPDF_Array* pArray = GetArray(key); | 700 CPDF_Array* pArray = GetArray(key); |
701 if (pArray) | 701 if (pArray) |
702 rect = pArray->GetRect(); | 702 rect = pArray->GetRect(); |
703 return rect; | 703 return rect; |
704 } | 704 } |
705 CFX_AffineMatrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const { | 705 CFX_Matrix CPDF_Dictionary::GetMatrix(const CFX_ByteStringC& key) const { |
706 CFX_AffineMatrix matrix; | 706 CFX_Matrix matrix; |
707 CPDF_Array* pArray = GetArray(key); | 707 CPDF_Array* pArray = GetArray(key); |
708 if (pArray) | 708 if (pArray) |
709 matrix = pArray->GetMatrix(); | 709 matrix = pArray->GetMatrix(); |
710 return matrix; | 710 return matrix; |
711 } | 711 } |
712 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { | 712 FX_BOOL CPDF_Dictionary::KeyExist(const CFX_ByteStringC& key) const { |
713 void* value; | 713 void* value; |
714 return m_Map.Lookup(key, value); | 714 return m_Map.Lookup(key, value); |
715 } | 715 } |
716 | 716 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 void CPDF_Dictionary::SetAtRect(const CFX_ByteStringC& key, | 807 void CPDF_Dictionary::SetAtRect(const CFX_ByteStringC& key, |
808 const CFX_FloatRect& rect) { | 808 const CFX_FloatRect& rect) { |
809 CPDF_Array* pArray = new CPDF_Array; | 809 CPDF_Array* pArray = new CPDF_Array; |
810 pArray->AddNumber(rect.left); | 810 pArray->AddNumber(rect.left); |
811 pArray->AddNumber(rect.bottom); | 811 pArray->AddNumber(rect.bottom); |
812 pArray->AddNumber(rect.right); | 812 pArray->AddNumber(rect.right); |
813 pArray->AddNumber(rect.top); | 813 pArray->AddNumber(rect.top); |
814 SetAt(key, pArray); | 814 SetAt(key, pArray); |
815 } | 815 } |
816 void CPDF_Dictionary::SetAtMatrix(const CFX_ByteStringC& key, | 816 void CPDF_Dictionary::SetAtMatrix(const CFX_ByteStringC& key, |
817 const CFX_AffineMatrix& matrix) { | 817 const CFX_Matrix& matrix) { |
818 CPDF_Array* pArray = new CPDF_Array; | 818 CPDF_Array* pArray = new CPDF_Array; |
819 pArray->AddNumber16(matrix.a); | 819 pArray->AddNumber16(matrix.a); |
820 pArray->AddNumber16(matrix.b); | 820 pArray->AddNumber16(matrix.b); |
821 pArray->AddNumber16(matrix.c); | 821 pArray->AddNumber16(matrix.c); |
822 pArray->AddNumber16(matrix.d); | 822 pArray->AddNumber16(matrix.d); |
823 pArray->AddNumber(matrix.e); | 823 pArray->AddNumber(matrix.e); |
824 pArray->AddNumber(matrix.f); | 824 pArray->AddNumber(matrix.f); |
825 SetAt(key, pArray); | 825 SetAt(key, pArray); |
826 } | 826 } |
827 CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) | 827 CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1172 } | 1172 } |
1173 pObj->m_ObjNum = objnum; | 1173 pObj->m_ObjNum = objnum; |
1174 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); | 1174 m_IndirectObjs.SetAt((void*)(uintptr_t)objnum, pObj); |
1175 if (m_LastObjNum < objnum) { | 1175 if (m_LastObjNum < objnum) { |
1176 m_LastObjNum = objnum; | 1176 m_LastObjNum = objnum; |
1177 } | 1177 } |
1178 } | 1178 } |
1179 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { | 1179 FX_DWORD CPDF_IndirectObjects::GetLastObjNum() const { |
1180 return m_LastObjNum; | 1180 return m_LastObjNum; |
1181 } | 1181 } |
OLD | NEW |