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

Side by Side Diff: fpdfsdk/fpdfeditpage.cpp

Issue 1918113002: Clean up CPDF_Page. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: more Created 4 years, 8 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
« no previous file with comments | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "public/fpdf_edit.h" 7 #include "public/fpdf_edit.h"
8 8
9 #include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h" 9 #include "core/fpdfapi/fpdf_edit/include/cpdf_pagecontentgenerator.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 pPageDict->SetAt("MediaBox", pMediaBoxArray); 94 pPageDict->SetAt("MediaBox", pMediaBoxArray);
95 pPageDict->SetAt("Rotate", new CPDF_Number(0)); 95 pPageDict->SetAt("Rotate", new CPDF_Number(0));
96 pPageDict->SetAt("Resources", new CPDF_Dictionary); 96 pPageDict->SetAt("Resources", new CPDF_Dictionary);
97 97
98 #ifdef PDF_ENABLE_XFA 98 #ifdef PDF_ENABLE_XFA
99 CPDFXFA_Page* pPage = 99 CPDFXFA_Page* pPage =
100 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index); 100 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index);
101 pPage->LoadPDFPage(pPageDict); 101 pPage->LoadPDFPage(pPageDict);
102 #else // PDF_ENABLE_XFA 102 #else // PDF_ENABLE_XFA
103 CPDF_Page* pPage = new CPDF_Page; 103 CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true);
104 pPage->Load(pDoc, pPageDict); 104 pPage->ParseContent();
105 pPage->ParseContent(nullptr);
106 #endif // PDF_ENABLE_XFA 105 #endif // PDF_ENABLE_XFA
107 106
108 return pPage; 107 return pPage;
109 } 108 }
110 109
111 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) { 110 DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page) {
112 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 111 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
113 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || 112 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
114 !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || 113 !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() ||
115 pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( 114 pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare(
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() || 312 !pPage->m_pFormDict->GetObjectBy("Type")->GetDirect() ||
314 pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare( 313 pPage->m_pFormDict->GetObjectBy("Type")->GetDirect()->GetString().Compare(
315 "Page")) { 314 "Page")) {
316 return; 315 return;
317 } 316 }
318 CPDF_Dictionary* pDict = pPage->m_pFormDict; 317 CPDF_Dictionary* pDict = pPage->m_pFormDict;
319 rotate %= 4; 318 rotate %= 4;
320 319
321 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 320 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
322 } 321 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_flatten.cpp ('k') | fpdfsdk/fpdfview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698