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

Side by Side Diff: fpdfsdk/src/fpdfeditpage.cpp

Issue 1540693002: Get rid of a few CPDF_Object Create() methods and just use new instead. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase Created 5 years 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 | « core/src/fpdfdoc/doc_utils.cpp ('k') | fpdfsdk/src/fpdfppo.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 "fpdfsdk/include/fsdk_define.h" 9 #include "fpdfsdk/include/fsdk_define.h"
10 #include "public/fpdf_formfill.h" 10 #include "public/fpdf_formfill.h"
(...skipping 19 matching lines...) Expand all
30 pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min, 30 pTM->tm_mon + 1, pTM->tm_mday, pTM->tm_hour, pTM->tm_min,
31 pTM->tm_sec); 31 pTM->tm_sec);
32 } 32 }
33 } 33 }
34 } 34 }
35 35
36 CPDF_Dictionary* pInfoDict = NULL; 36 CPDF_Dictionary* pInfoDict = NULL;
37 pInfoDict = pDoc->GetInfo(); 37 pInfoDict = pDoc->GetInfo();
38 if (pInfoDict) { 38 if (pInfoDict) {
39 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) 39 if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
40 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr)); 40 pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr, FALSE));
41 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium")); 41 pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium"));
42 } 42 }
43 43
44 return FPDFDocumentFromCPDFDocument(pDoc); 44 return FPDFDocumentFromCPDFDocument(pDoc);
45 } 45 }
46 46
47 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) { 47 DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index) {
48 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document); 48 CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
49 if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount()) 49 if (!pDoc || page_index < 0 || page_index >= pDoc->GetPageCount())
50 return; 50 return;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 CPDF_Annot* pAnnot = AnnotList.GetAt(i); 266 CPDF_Annot* pAnnot = AnnotList.GetAt(i);
267 // transformAnnots Rectangle 267 // transformAnnots Rectangle
268 CPDF_Rect rect; 268 CPDF_Rect rect;
269 pAnnot->GetRect(rect); 269 pAnnot->GetRect(rect);
270 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, 270 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
271 (FX_FLOAT)e, (FX_FLOAT)f); 271 (FX_FLOAT)e, (FX_FLOAT)f);
272 rect.Transform(&matrix); 272 rect.Transform(&matrix);
273 CPDF_Array* pRectArray = NULL; 273 CPDF_Array* pRectArray = NULL;
274 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect"); 274 pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
275 if (!pRectArray) 275 if (!pRectArray)
276 pRectArray = CPDF_Array::Create(); 276 pRectArray = new CPDF_Array;
277 pRectArray->SetAt(0, new CPDF_Number(rect.left)); 277 pRectArray->SetAt(0, new CPDF_Number(rect.left));
278 pRectArray->SetAt(1, new CPDF_Number(rect.bottom)); 278 pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
279 pRectArray->SetAt(2, new CPDF_Number(rect.right)); 279 pRectArray->SetAt(2, new CPDF_Number(rect.right));
280 pRectArray->SetAt(3, new CPDF_Number(rect.top)); 280 pRectArray->SetAt(3, new CPDF_Number(rect.top));
281 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray); 281 pAnnot->GetAnnotDict()->SetAt("Rect", pRectArray);
282 282
283 // Transform AP's rectangle 283 // Transform AP's rectangle
284 // To Do 284 // To Do
285 } 285 }
286 } 286 }
287 287
288 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) { 288 DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate) {
289 CPDF_Page* pPage = CPDFPageFromFPDFPage(page); 289 CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
290 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") || 290 if (!pPage || !pPage->m_pFormDict || !pPage->m_pFormDict->KeyExist("Type") ||
291 !pPage->m_pFormDict->GetElement("Type")->GetDirect() || 291 !pPage->m_pFormDict->GetElement("Type")->GetDirect() ||
292 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare( 292 pPage->m_pFormDict->GetElement("Type")->GetDirect()->GetString().Compare(
293 "Page")) { 293 "Page")) {
294 return; 294 return;
295 } 295 }
296 CPDF_Dictionary* pDict = pPage->m_pFormDict; 296 CPDF_Dictionary* pDict = pPage->m_pFormDict;
297 rotate %= 4; 297 rotate %= 4;
298 298
299 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90)); 299 pDict->SetAt("Rotate", new CPDF_Number(rotate * 90));
300 } 300 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | fpdfsdk/src/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698