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

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

Issue 1084613006: Fix all remaining instances of FX_NEW. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: std::min Created 5 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 | « core/src/reflow/reflowengine.cpp ('k') | no next file » | 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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fpdf_flatten.h" 8 #include "../include/fpdf_flatten.h"
9 9
10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray; 10 typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray;
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (!pContentsObj) 208 if (!pContentsObj)
209 { 209 {
210 pContentsObj = pPage->GetArray("Contents"); 210 pContentsObj = pPage->GetArray("Contents");
211 } 211 }
212 212
213 if (!pContentsObj) 213 if (!pContentsObj)
214 { 214 {
215 //Create a new contents dictionary 215 //Create a new contents dictionary
216 if (!key.IsEmpty()) 216 if (!key.IsEmpty())
217 { 217 {
218 » » » CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, FX_ NEW CPDF_Dictionary); 218 » » » CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary);
219 pPage->SetAtReference("Contents", pDocument, pDocument-> AddIndirectObject(pNewContents)); 219 pPage->SetAtReference("Contents", pDocument, pDocument-> AddIndirectObject(pNewContents));
220 220
221 CFX_ByteString sStream; 221 CFX_ByteString sStream;
222 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()) ; 222 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()) ;
223 pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLe ngth(), FALSE, FALSE); 223 pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLe ngth(), FALSE, FALSE);
224 } 224 }
225 return; 225 return;
226 } 226 }
227 227
228 int iType = pContentsObj->GetType(); 228 int iType = pContentsObj->GetType();
(...skipping 25 matching lines...) Expand all
254 break; 254 break;
255 } 255 }
256 256
257 if (!pContentsArray)return; 257 if (!pContentsArray)return;
258 258
259 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContentsArray); 259 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pContentsArray);
260 pPage->SetAtReference("Contents", pDocument, dwObjNum); 260 pPage->SetAtReference("Contents", pDocument, dwObjNum);
261 261
262 if (!key.IsEmpty()) 262 if (!key.IsEmpty())
263 { 263 {
264 » » CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, FX_NEW CPDF _Dictionary); 264 » » CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Di ctionary);
265 dwObjNum = pDocument->AddIndirectObject(pNewContents); 265 dwObjNum = pDocument->AddIndirectObject(pNewContents);
266 pContentsArray->AddReference(pDocument, dwObjNum); 266 pContentsArray->AddReference(pDocument, dwObjNum);
267 » » 267
268 CFX_ByteString sStream; 268 CFX_ByteString sStream;
269 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); 269 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
270 pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE); 270 pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE);
271 } 271 }
272 } 272 }
273 273
274 CFX_AffineMatrix GetMatrix(CPDF_Rect rcAnnot, CPDF_Rect rcStream, CFX_AffineMatr ix matrix) 274 CFX_AffineMatrix GetMatrix(CPDF_Rect rcAnnot, CPDF_Rect rcStream, CFX_AffineMatr ix matrix)
275 { 275 {
276 if(rcStream.IsEmpty()) 276 if(rcStream.IsEmpty())
277 return CFX_AffineMatrix(); 277 return CFX_AffineMatrix();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 pCropBox->Add(new CPDF_Number(rcOriginalCB.bottom)); 392 pCropBox->Add(new CPDF_Number(rcOriginalCB.bottom));
393 pCropBox->Add(new CPDF_Number(rcOriginalCB.right)); 393 pCropBox->Add(new CPDF_Number(rcOriginalCB.right));
394 pCropBox->Add(new CPDF_Number(rcOriginalCB.top)); 394 pCropBox->Add(new CPDF_Number(rcOriginalCB.top));
395 pPageDict->SetAt("ArtBox", pCropBox); 395 pPageDict->SetAt("ArtBox", pCropBox);
396 } 396 }
397 397
398 CPDF_Dictionary* pRes = pPageDict->GetDict("Resources"); 398 CPDF_Dictionary* pRes = pPageDict->GetDict("Resources");
399 if (!pRes) 399 if (!pRes)
400 { 400 {
401 pRes = new CPDF_Dictionary; 401 pRes = new CPDF_Dictionary;
402 » » pPageDict->SetAt("Resources", pRes); 402 » » pPageDict->SetAt("Resources", pRes );
403 } 403 }
404 404
405 » CPDF_Stream* pNewXObject = new CPDF_Stream(NULL, 0, FX_NEW CPDF_Dictiona ry); 405 » CPDF_Stream* pNewXObject = new CPDF_Stream(NULL, 0, new CPDF_Dictionary) ;
406 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pNewXObject); 406 FX_DWORD dwObjNum = pDocument->AddIndirectObject(pNewXObject);
407 CPDF_Dictionary* pPageXObject = pRes->GetDict("XObject"); 407 CPDF_Dictionary* pPageXObject = pRes->GetDict("XObject");
408 if (!pPageXObject) 408 if (!pPageXObject)
409 { 409 {
410 pPageXObject = new CPDF_Dictionary; 410 pPageXObject = new CPDF_Dictionary;
411 pRes->SetAt("XObject", pPageXObject); 411 pRes->SetAt("XObject", pPageXObject);
412 } 412 }
413 413
414 CFX_ByteString key = ""; 414 CFX_ByteString key = "";
415 int nStreams = ObjectArray.GetSize(); 415 int nStreams = ObjectArray.GetSize();
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 548
549 pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), F ALSE, FALSE); 549 pNewXObject->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), F ALSE, FALSE);
550 } 550 }
551 pPageDict->RemoveAt( "Annots" ); 551 pPageDict->RemoveAt( "Annots" );
552 552
553 ObjectArray.RemoveAll(); 553 ObjectArray.RemoveAll();
554 RectArray.RemoveAll(); 554 RectArray.RemoveAll();
555 555
556 return FLATTEN_SUCCESS; 556 return FLATTEN_SUCCESS;
557 } 557 }
OLDNEW
« no previous file with comments | « core/src/reflow/reflowengine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698