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

Side by Side Diff: core/fpdfapi/page/cpdf_docpagedata.cpp

Issue 2520133002: Remove some WrapUnique() calls by returing unique_ptrs (Closed)
Patch Set: rebase Created 4 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/fpdfapi/font/cpdf_fontencoding.cpp ('k') | core/fpdfapi/page/cpdf_image.h » ('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 "core/fpdfapi/page/cpdf_docpagedata.h" 7 #include "core/fpdfapi/page/cpdf_docpagedata.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 continue; 175 continue;
176 176
177 return fontData->AddRef(); 177 return fontData->AddRef();
178 } 178 }
179 179
180 CPDF_Dictionary* pDict = m_pPDFDoc->NewIndirect<CPDF_Dictionary>(); 180 CPDF_Dictionary* pDict = m_pPDFDoc->NewIndirect<CPDF_Dictionary>();
181 pDict->SetNewFor<CPDF_Name>("Type", "Font"); 181 pDict->SetNewFor<CPDF_Name>("Type", "Font");
182 pDict->SetNewFor<CPDF_Name>("Subtype", "Type1"); 182 pDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
183 pDict->SetNewFor<CPDF_Name>("BaseFont", fontName); 183 pDict->SetNewFor<CPDF_Name>("BaseFont", fontName);
184 if (pEncoding) { 184 if (pEncoding) {
185 pDict->SetFor( 185 pDict->SetFor("Encoding",
186 "Encoding", 186 pEncoding->Realize(m_pPDFDoc->GetByteStringPool()));
187 pdfium::WrapUnique(pEncoding->Realize(m_pPDFDoc->GetByteStringPool())));
188 } 187 }
189 188
190 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict); 189 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict);
191 if (!pFont) 190 if (!pFont)
192 return nullptr; 191 return nullptr;
193 192
194 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release()); 193 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release());
195 m_FontMap[pDict] = fontData; 194 m_FontMap[pDict] = fontData;
196 return fontData->AddRef(); 195 return fontData->AddRef();
197 } 196 }
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 } 529 }
531 530
532 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( 531 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(
533 CPDF_Object* pPatternObj) const { 532 CPDF_Object* pPatternObj) const {
534 if (!pPatternObj) 533 if (!pPatternObj)
535 return nullptr; 534 return nullptr;
536 535
537 auto it = m_PatternMap.find(pPatternObj); 536 auto it = m_PatternMap.find(pPatternObj);
538 return it != m_PatternMap.end() ? it->second : nullptr; 537 return it != m_PatternMap.end() ? it->second : nullptr;
539 } 538 }
OLDNEW
« no previous file with comments | « core/fpdfapi/font/cpdf_fontencoding.cpp ('k') | core/fpdfapi/page/cpdf_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698