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

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

Issue 2509123002: Make CPDF_Object subclass constructors intern strings (Closed)
Patch Set: Nits 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/fpdfapi/font/cpdf_fontencoding.cpp ('k') | core/fpdfapi/page/cpdf_streamcontentparser.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 "core/fpdfapi/page/cpdf_docpagedata.h" 7 #include "core/fpdfapi/page/cpdf_docpagedata.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 if (pFont->GetFontDict()->KeyExist("Widths")) 168 if (pFont->GetFontDict()->KeyExist("Widths"))
169 continue; 169 continue;
170 170
171 CPDF_Type1Font* pT1Font = pFont->AsType1Font(); 171 CPDF_Type1Font* pT1Font = pFont->AsType1Font();
172 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) 172 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding))
173 continue; 173 continue;
174 174
175 return fontData->AddRef(); 175 return fontData->AddRef();
176 } 176 }
177 177
178 CPDF_Dictionary* pDict = 178 CPDF_Dictionary* pDict = m_pPDFDoc->NewIndirect<CPDF_Dictionary>();
179 m_pPDFDoc->NewIndirect<CPDF_Dictionary>(m_pPDFDoc->GetByteStringPool());
180 pDict->SetNameFor("Type", "Font"); 179 pDict->SetNameFor("Type", "Font");
181 pDict->SetNameFor("Subtype", "Type1"); 180 pDict->SetNameFor("Subtype", "Type1");
182 pDict->SetNameFor("BaseFont", fontName); 181 pDict->SetNameFor("BaseFont", fontName);
183 if (pEncoding) { 182 if (pEncoding) {
184 pDict->SetFor("Encoding", 183 pDict->SetFor("Encoding",
185 pEncoding->Realize(m_pPDFDoc->GetByteStringPool())); 184 pEncoding->Realize(m_pPDFDoc->GetByteStringPool()));
186 } 185 }
187 186
188 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict); 187 std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict);
189 if (!pFont) 188 if (!pFont)
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 } 527 }
529 528
530 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( 529 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(
531 CPDF_Object* pPatternObj) const { 530 CPDF_Object* pPatternObj) const {
532 if (!pPatternObj) 531 if (!pPatternObj)
533 return nullptr; 532 return nullptr;
534 533
535 auto it = m_PatternMap.find(pPatternObj); 534 auto it = m_PatternMap.find(pPatternObj);
536 return it != m_PatternMap.end() ? it->second : nullptr; 535 return it != m_PatternMap.end() ? it->second : nullptr;
537 } 536 }
OLDNEW
« no previous file with comments | « core/fpdfapi/font/cpdf_fontencoding.cpp ('k') | core/fpdfapi/page/cpdf_streamcontentparser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698