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

Side by Side Diff: fpdfsdk/fpdf_flatten.cpp

Issue 2484033002: Return unique_ptr from CPDF_Object::Clone(). (Closed)
Patch Set: std::move() it Created 4 years, 1 month 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/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/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_flatten.h" 7 #include "public/fpdf_flatten.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 if (pAPDic->KeyExist("Rect")) 401 if (pAPDic->KeyExist("Rect"))
402 rcStream = pAPDic->GetRectFor("Rect"); 402 rcStream = pAPDic->GetRectFor("Rect");
403 else if (pAPDic->KeyExist("BBox")) 403 else if (pAPDic->KeyExist("BBox"))
404 rcStream = pAPDic->GetRectFor("BBox"); 404 rcStream = pAPDic->GetRectFor("BBox");
405 405
406 if (rcStream.IsEmpty()) 406 if (rcStream.IsEmpty())
407 continue; 407 continue;
408 408
409 CPDF_Object* pObj = pAPStream; 409 CPDF_Object* pObj = pAPStream;
410 if (pObj->IsInline()) { 410 if (pObj->IsInline()) {
411 pObj = pObj->Clone(); 411 std::unique_ptr<CPDF_Object> pNew = pObj->Clone();
412 pDocument->AddIndirectObject(pObj); 412 pObj = pNew.get();
413 pDocument->AddIndirectObject(pNew.release());
413 } 414 }
414 415
415 CPDF_Dictionary* pObjDic = pObj->GetDict(); 416 CPDF_Dictionary* pObjDic = pObj->GetDict();
416 if (pObjDic) { 417 if (pObjDic) {
417 pObjDic->SetNameFor("Type", "XObject"); 418 pObjDic->SetNameFor("Type", "XObject");
418 pObjDic->SetNameFor("Subtype", "Form"); 419 pObjDic->SetNameFor("Subtype", "Form");
419 } 420 }
420 421
421 CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject"); 422 CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject");
422 if (!pXObject) { 423 if (!pXObject) {
(...skipping 25 matching lines...) Expand all
448 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f, 449 sTemp.Format("q %f 0 0 %f %f %f cm /%s Do Q\n", m.a, m.d, m.e, m.f,
449 sFormName.c_str()); 450 sFormName.c_str());
450 sStream += sTemp; 451 sStream += sTemp;
451 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength()); 452 pNewXObject->SetData(sStream.raw_str(), sStream.GetLength());
452 } 453 }
453 pPageDict->RemoveFor("Annots"); 454 pPageDict->RemoveFor("Annots");
454 455
455 RectArray.RemoveAll(); 456 RectArray.RemoveAll();
456 return FLATTEN_SUCCESS; 457 return FLATTEN_SUCCESS;
457 } 458 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpvt_generateap.cpp ('k') | fpdfsdk/fpdfppo.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698