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

Side by Side Diff: core/fpdfdoc/cpvt_generateap.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/cpdf_interform.cpp ('k') | fpdfsdk/fpdf_flatten.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 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "core/fpdfdoc/cpvt_generateap.h" 7 #include "core/fpdfdoc/cpvt_generateap.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (pStreamResList) { 179 if (pStreamResList) {
180 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font"); 180 CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font");
181 if (!pStreamResFontList) { 181 if (!pStreamResFontList) {
182 pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool()); 182 pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool());
183 pStreamResList->SetFor("Font", pStreamResFontList); 183 pStreamResList->SetFor("Font", pStreamResFontList);
184 } 184 }
185 if (!pStreamResFontList->KeyExist(sFontName)) 185 if (!pStreamResFontList->KeyExist(sFontName))
186 pStreamResFontList->SetReferenceFor(sFontName, pDoc, 186 pStreamResFontList->SetReferenceFor(sFontName, pDoc,
187 pFontDict->GetObjNum()); 187 pFontDict->GetObjNum());
188 } else { 188 } else {
189 pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone()); 189 pStreamDict->SetFor("Resources",
190 pFormDict->GetDictFor("DR")->Clone().release());
190 pStreamResList = pStreamDict->GetDictFor("Resources"); 191 pStreamResList = pStreamDict->GetDictFor("Resources");
191 } 192 }
192 } 193 }
193 switch (nWidgetType) { 194 switch (nWidgetType) {
194 case 0: { 195 case 0: {
195 CFX_WideString swValue = 196 CFX_WideString swValue =
196 FPDF_GetFieldAttr(pAnnotDict, "V") 197 FPDF_GetFieldAttr(pAnnotDict, "V")
197 ? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() 198 ? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText()
198 : CFX_WideString(); 199 : CFX_WideString();
199 int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q") 200 int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 CPDF_Dictionary* pStreamResFontList = 431 CPDF_Dictionary* pStreamResFontList =
431 pStreamResList->GetDictFor("Font"); 432 pStreamResList->GetDictFor("Font");
432 if (!pStreamResFontList) { 433 if (!pStreamResFontList) {
433 pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool()); 434 pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool());
434 pStreamResList->SetFor("Font", pStreamResFontList); 435 pStreamResList->SetFor("Font", pStreamResFontList);
435 } 436 }
436 if (!pStreamResFontList->KeyExist(sFontName)) 437 if (!pStreamResFontList->KeyExist(sFontName))
437 pStreamResFontList->SetReferenceFor(sFontName, pDoc, 438 pStreamResFontList->SetReferenceFor(sFontName, pDoc,
438 pFontDict->GetObjNum()); 439 pFontDict->GetObjNum());
439 } else { 440 } else {
440 pStreamDict->SetFor("Resources", pFormDict->GetDictFor("DR")->Clone()); 441 pStreamDict->SetFor("Resources",
442 pFormDict->GetDictFor("DR")->Clone().release());
441 pStreamResList = pStreamDict->GetDictFor("Resources"); 443 pStreamResList = pStreamDict->GetDictFor("Resources");
442 } 444 }
443 } 445 }
444 } 446 }
445 return true; 447 return true;
446 } 448 }
447 449
448 CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor, 450 CFX_ByteString GetColorStringWithDefault(CPDF_Array* pColor,
449 const CPVT_Color& crDefaultColor, 451 const CPVT_Color& crDefaultColor,
450 PaintOperation nOperation) { 452 PaintOperation nOperation) {
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after
1353 int32_t nFontIndex, 1355 int32_t nFontIndex,
1354 FX_FLOAT fFontSize) { 1356 FX_FLOAT fFontSize) {
1355 CFX_ByteTextBuf sRet; 1357 CFX_ByteTextBuf sRet;
1356 if (pFontMap) { 1358 if (pFontMap) {
1357 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); 1359 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
1358 if (sFontAlias.GetLength() > 0 && fFontSize > 0) 1360 if (sFontAlias.GetLength() > 0 && fFontSize > 0)
1359 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; 1361 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
1360 } 1362 }
1361 return sRet.MakeString(); 1363 return sRet.MakeString();
1362 } 1364 }
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_interform.cpp ('k') | fpdfsdk/fpdf_flatten.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698