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 "../../public/fpdf_transformpage.h" | 7 #include "../../public/fpdf_transformpage.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); | 144 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); |
145 pContentArray->InsertAt(0, pRef); | 145 pContentArray->InsertAt(0, pRef); |
146 pContentArray->AddReference(pDoc, pEndStream); | 146 pContentArray->AddReference(pDoc, pEndStream); |
147 | 147 |
148 } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { | 148 } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { |
149 CPDF_Reference* pReference = (CPDF_Reference*)pContentObj; | 149 CPDF_Reference* pReference = (CPDF_Reference*)pContentObj; |
150 CPDF_Object* pDirectObj = pReference->GetDirect(); | 150 CPDF_Object* pDirectObj = pReference->GetDirect(); |
151 if (pDirectObj != NULL) { | 151 if (pDirectObj != NULL) { |
152 if (pDirectObj->GetType() == PDFOBJ_ARRAY) { | 152 if (pDirectObj->GetType() == PDFOBJ_ARRAY) { |
153 pContentArray = (CPDF_Array*)pDirectObj; | 153 pContentArray = (CPDF_Array*)pDirectObj; |
154 CPDF_Reference* pRef = | 154 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); |
155 new CPDF_Reference(pDoc, pStream->GetObjNum()); | |
156 pContentArray->InsertAt(0, pRef); | 155 pContentArray->InsertAt(0, pRef); |
157 pContentArray->AddReference(pDoc, pEndStream); | 156 pContentArray->AddReference(pDoc, pEndStream); |
158 | 157 |
159 } else if (pDirectObj->GetType() == PDFOBJ_STREAM) { | 158 } else if (pDirectObj->GetType() == PDFOBJ_STREAM) { |
160 pContentArray = new CPDF_Array(); | 159 pContentArray = new CPDF_Array(); |
161 pContentArray->AddReference(pDoc, pStream->GetObjNum()); | 160 pContentArray->AddReference(pDoc, pStream->GetObjNum()); |
162 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); | 161 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); |
163 pContentArray->AddReference(pDoc, pEndStream); | 162 pContentArray->AddReference(pDoc, pEndStream); |
164 pPageDic->SetAtReference("Contents", pDoc, | 163 pPageDic->SetAtReference("Contents", pDoc, |
165 pDoc->AddIndirectObject(pContentArray)); | 164 pDoc->AddIndirectObject(pContentArray)); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 pContentArray = (CPDF_Array*)pContentObj; | 316 pContentArray = (CPDF_Array*)pContentObj; |
318 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); | 317 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); |
319 pContentArray->InsertAt(0, pRef); | 318 pContentArray->InsertAt(0, pRef); |
320 | 319 |
321 } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { | 320 } else if (pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE) { |
322 CPDF_Reference* pReference = (CPDF_Reference*)pContentObj; | 321 CPDF_Reference* pReference = (CPDF_Reference*)pContentObj; |
323 CPDF_Object* pDirectObj = pReference->GetDirect(); | 322 CPDF_Object* pDirectObj = pReference->GetDirect(); |
324 if (pDirectObj != NULL) { | 323 if (pDirectObj != NULL) { |
325 if (pDirectObj->GetType() == PDFOBJ_ARRAY) { | 324 if (pDirectObj->GetType() == PDFOBJ_ARRAY) { |
326 pContentArray = (CPDF_Array*)pDirectObj; | 325 pContentArray = (CPDF_Array*)pDirectObj; |
327 CPDF_Reference* pRef = | 326 CPDF_Reference* pRef = new CPDF_Reference(pDoc, pStream->GetObjNum()); |
328 new CPDF_Reference(pDoc, pStream->GetObjNum()); | |
329 pContentArray->InsertAt(0, pRef); | 327 pContentArray->InsertAt(0, pRef); |
330 | 328 |
331 } else if (pDirectObj->GetType() == PDFOBJ_STREAM) { | 329 } else if (pDirectObj->GetType() == PDFOBJ_STREAM) { |
332 pContentArray = new CPDF_Array(); | 330 pContentArray = new CPDF_Array(); |
333 pContentArray->AddReference(pDoc, pStream->GetObjNum()); | 331 pContentArray->AddReference(pDoc, pStream->GetObjNum()); |
334 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); | 332 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); |
335 pPageDic->SetAtReference("Contents", pDoc, | 333 pPageDic->SetAtReference("Contents", pDoc, |
336 pDoc->AddIndirectObject(pContentArray)); | 334 pDoc->AddIndirectObject(pContentArray)); |
337 } | 335 } |
338 } | 336 } |
339 } | 337 } |
340 } | 338 } |
OLD | NEW |