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

Side by Side Diff: fpdfsdk/fpdfeditpage.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: Remove default ctor 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 "public/fpdf_edit.h" 7 #include "public/fpdf_edit.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 page_index = std::min(std::max(page_index, 0), pDoc->GetPageCount()); 108 page_index = std::min(std::max(page_index, 0), pDoc->GetPageCount());
109 CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index); 109 CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
110 if (!pPageDict) 110 if (!pPageDict)
111 return nullptr; 111 return nullptr;
112 112
113 CPDF_Array* pMediaBoxArray = new CPDF_Array; 113 CPDF_Array* pMediaBoxArray = new CPDF_Array;
114 pMediaBoxArray->Add(new CPDF_Number(0)); 114 pMediaBoxArray->Add(new CPDF_Number(0));
115 pMediaBoxArray->Add(new CPDF_Number(0)); 115 pMediaBoxArray->Add(new CPDF_Number(0));
116 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width))); 116 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(width)));
117 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height))); 117 pMediaBoxArray->Add(new CPDF_Number(FX_FLOAT(height)));
118
119 pPageDict->SetFor("MediaBox", pMediaBoxArray); 118 pPageDict->SetFor("MediaBox", pMediaBoxArray);
120 pPageDict->SetFor("Rotate", new CPDF_Number(0)); 119 pPageDict->SetFor("Rotate", new CPDF_Number(0));
121 pPageDict->SetFor("Resources", new CPDF_Dictionary); 120 pPageDict->SetFor("Resources", new CPDF_Dictionary(pDoc));
122 121
123 #ifdef PDF_ENABLE_XFA 122 #ifdef PDF_ENABLE_XFA
124 CPDFXFA_Page* pPage = 123 CPDFXFA_Page* pPage =
125 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index); 124 new CPDFXFA_Page((CPDFXFA_Document*)document, page_index);
126 pPage->LoadPDFPage(pPageDict); 125 pPage->LoadPDFPage(pPageDict);
127 #else // PDF_ENABLE_XFA 126 #else // PDF_ENABLE_XFA
128 CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true); 127 CPDF_Page* pPage = new CPDF_Page(pDoc, pPageDict, true);
129 pPage->ParseContent(); 128 pPage->ParseContent();
130 #endif // PDF_ENABLE_XFA 129 #endif // PDF_ENABLE_XFA
131 130
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 309
311 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { 310 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) {
312 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 311 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
313 if (!IsPageObject(pPage)) 312 if (!IsPageObject(pPage))
314 return; 313 return;
315 314
316 CPDF_Dictionary* pDict = pPage->m_pFormDict; 315 CPDF_Dictionary* pDict = pPage->m_pFormDict;
317 rotate %= 4; 316 rotate %= 4;
318 pDict->SetFor("Rotate", new CPDF_Number(rotate * 90)); 317 pDict->SetFor("Rotate", new CPDF_Number(rotate * 90));
319 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698