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

Side by Side Diff: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: Remove default ctor Created 4 years, 3 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
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/fpdf_page/pageint.h" 7 #include "core/fpdfapi/fpdf_page/pageint.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 if (pFont->GetFontDict()->KeyExist("Widths")) 177 if (pFont->GetFontDict()->KeyExist("Widths"))
178 continue; 178 continue;
179 179
180 CPDF_Type1Font* pT1Font = pFont->AsType1Font(); 180 CPDF_Type1Font* pT1Font = pFont->AsType1Font();
181 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding)) 181 if (pEncoding && !pT1Font->GetEncoding()->IsIdentical(pEncoding))
182 continue; 182 continue;
183 183
184 return fontData->AddRef(); 184 return fontData->AddRef();
185 } 185 }
186 186
187 CPDF_Dictionary* pDict = new CPDF_Dictionary; 187 CPDF_Dictionary* pDict = new CPDF_Dictionary(m_pPDFDoc);
188 pDict->SetNameFor("Type", "Font"); 188 pDict->SetNameFor("Type", "Font");
189 pDict->SetNameFor("Subtype", "Type1"); 189 pDict->SetNameFor("Subtype", "Type1");
190 pDict->SetNameFor("BaseFont", fontName); 190 pDict->SetNameFor("BaseFont", fontName);
191 if (pEncoding) { 191 if (pEncoding) {
192 pDict->SetFor("Encoding", pEncoding->Realize()); 192 pDict->SetFor("Encoding", pEncoding->Realize(m_pPDFDoc));
193 } 193 }
194 m_pPDFDoc->AddIndirectObject(pDict); 194 m_pPDFDoc->AddIndirectObject(pDict);
195 CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict); 195 CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict);
196 if (!pFont) { 196 if (!pFont) {
197 return nullptr; 197 return nullptr;
198 } 198 }
199 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont); 199 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont);
200 m_FontMap[pDict] = fontData; 200 m_FontMap[pDict] = fontData;
201 return fontData->AddRef(); 201 return fontData->AddRef();
202 } 202 }
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 } 543 }
544 544
545 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( 545 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(
546 CPDF_Object* pPatternObj) const { 546 CPDF_Object* pPatternObj) const {
547 if (!pPatternObj) 547 if (!pPatternObj)
548 return nullptr; 548 return nullptr;
549 549
550 auto it = m_PatternMap.find(pPatternObj); 550 auto it = m_PatternMap.find(pPatternObj);
551 return it != m_PatternMap.end() ? it->second : nullptr; 551 return it != m_PatternMap.end() ? it->second : nullptr;
552 } 552 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698