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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 } | 1027 } |
1028 CFX_DWordArray IndexArray, WidthArray; | 1028 CFX_DWordArray IndexArray, WidthArray; |
1029 FX_DWORD nSegs = 0; | 1029 FX_DWORD nSegs = 0; |
1030 CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); | 1030 CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index")); |
1031 if (pArray == NULL) { | 1031 if (pArray == NULL) { |
1032 IndexArray.Add(0); | 1032 IndexArray.Add(0); |
1033 IndexArray.Add(size); | 1033 IndexArray.Add(size); |
1034 nSegs = 1; | 1034 nSegs = 1; |
1035 } else { | 1035 } else { |
1036 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { | 1036 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) { |
1037 IndexArray.Add(pArray->GetInteger(i)); | 1037 CPDF_Object* pObj = pArray->GetElement(i); |
Tom Sepez
2014/09/09 23:53:46
Sorry, I'd be happier if you did this two at at ti
| |
1038 if (!pObj || (pObj->GetType() != PDFOBJ_NUMBER)) { | |
1039 break; | |
1040 } | |
1041 IndexArray.Add(pObj->GetInteger()); | |
1038 } | 1042 } |
1039 nSegs = pArray->GetCount() / 2; | 1043 FX_DWORD nIndexSize = IndexArray.GetSize(); |
1044 if (nIndexSize % 2) { | |
1045 IndexArray.RemoveAt(nIndexSize-1); | |
1046 } | |
1047 nSegs = nIndexSize / 2; | |
1040 } | 1048 } |
1041 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); | 1049 pArray = pStream->GetDict()->GetArray(FX_BSTRC("W")); |
1042 if (pArray == NULL) { | 1050 if (pArray == NULL) { |
1043 pStream->Release(); | 1051 pStream->Release(); |
1044 return FALSE; | 1052 return FALSE; |
1045 } | 1053 } |
1046 FX_DWORD totalwidth = 0; | 1054 FX_DWORD totalwidth = 0; |
1047 FX_DWORD i; | 1055 FX_DWORD i; |
1048 for (i = 0; i < pArray->GetCount(); i ++) { | 1056 for (i = 0; i < pArray->GetCount(); i ++) { |
1049 WidthArray.Add(pArray->GetInteger(i)); | 1057 WidthArray.Add(pArray->GetInteger(i)); |
(...skipping 3375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4425 { | 4433 { |
4426 FX_INT32 iSize = m_childNode.GetSize(); | 4434 FX_INT32 iSize = m_childNode.GetSize(); |
4427 for (FX_INT32 i = 0; i < iSize; ++i) { | 4435 for (FX_INT32 i = 0; i < iSize; ++i) { |
4428 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4436 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
4429 if (pNode) { | 4437 if (pNode) { |
4430 delete pNode; | 4438 delete pNode; |
4431 } | 4439 } |
4432 } | 4440 } |
4433 m_childNode.RemoveAll(); | 4441 m_childNode.RemoveAll(); |
4434 } | 4442 } |
OLD | NEW |