Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Side by Side Diff: core/fpdfapi/fpdf_parser/cpdf_document.cpp

Issue 2355083002: Make CPDF_Array not do indirect object creation. (Closed)
Patch Set: Missed two references Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/fpdfapi/fpdf_parser/include/cpdf_document.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 int nPages = pDoc->GetPageCount(); 295 int nPages = pDoc->GetPageCount();
296 if (iPage < 0 || iPage > nPages) 296 if (iPage < 0 || iPage > nPages)
297 return -1; 297 return -1;
298 298
299 if (iPage == nPages) { 299 if (iPage == nPages) {
300 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids"); 300 CPDF_Array* pPagesList = pPages->GetArrayFor("Kids");
301 if (!pPagesList) { 301 if (!pPagesList) {
302 pPagesList = new CPDF_Array; 302 pPagesList = new CPDF_Array;
303 pPages->SetFor("Kids", pPagesList); 303 pPages->SetFor("Kids", pPagesList);
304 } 304 }
305 pPagesList->Add(pPageDict, pDoc); 305 pPagesList->Add(new CPDF_Reference(pDoc, pPageDict->GetObjNum()));
306 pPages->SetIntegerFor("Count", nPages + 1); 306 pPages->SetIntegerFor("Count", nPages + 1);
307 pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum()); 307 pPageDict->SetReferenceFor("Parent", pDoc, pPages->GetObjNum());
308 } else { 308 } else {
309 std::set<CPDF_Dictionary*> stack = {pPages}; 309 std::set<CPDF_Dictionary*> stack = {pPages};
310 if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0) 310 if (InsertDeletePDFPage(pDoc, pPages, iPage, pPageDict, TRUE, &stack) < 0)
311 return -1; 311 return -1;
312 } 312 }
313 pageList.InsertAt(iPage, pPageDict->GetObjNum()); 313 pageList.InsertAt(iPage, pPageDict->GetObjNum());
314 return iPage; 314 return iPage;
315 } 315 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 pLogFont->lfWeight / 5); 999 pLogFont->lfWeight / 5);
1000 pFontDesc->SetIntegerFor("CapHeight", capheight); 1000 pFontDesc->SetIntegerFor("CapHeight", capheight);
1001 AddIndirectObject(pFontDesc); 1001 AddIndirectObject(pFontDesc);
1002 pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc); 1002 pFontDict->SetReferenceFor("FontDescriptor", this, pFontDesc);
1003 hFont = SelectObject(hDC, hFont); 1003 hFont = SelectObject(hDC, hFont);
1004 DeleteObject(hFont); 1004 DeleteObject(hFont);
1005 DeleteDC(hDC); 1005 DeleteDC(hDC);
1006 return LoadFont(pBaseDict); 1006 return LoadFont(pBaseDict);
1007 } 1007 }
1008 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1008 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp ('k') | core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698