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

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

Issue 2419173002: Update CPDF_IndirectObjectHolder APIs for unique objects (Closed)
Patch Set: Fix issues Created 4 years, 2 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
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/page/cpdf_image.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 = new CPDF_Dictionary(m_pPDFDoc->GetByteStringPool()); 178 CPDF_Dictionary* pDict =
179 m_pPDFDoc->AddIndirectDictionary(m_pPDFDoc->GetByteStringPool());
179 pDict->SetNameFor("Type", "Font"); 180 pDict->SetNameFor("Type", "Font");
180 pDict->SetNameFor("Subtype", "Type1"); 181 pDict->SetNameFor("Subtype", "Type1");
181 pDict->SetNameFor("BaseFont", fontName); 182 pDict->SetNameFor("BaseFont", fontName);
182 if (pEncoding) { 183 if (pEncoding) {
183 pDict->SetFor("Encoding", 184 pDict->SetFor("Encoding",
184 pEncoding->Realize(m_pPDFDoc->GetByteStringPool())); 185 pEncoding->Realize(m_pPDFDoc->GetByteStringPool()));
185 } 186 }
186 m_pPDFDoc->AddIndirectObject(pDict);
187 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);
188 if (!pFont) 188 if (!pFont)
189 return nullptr; 189 return nullptr;
190 190
191 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release()); 191 CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release());
192 m_FontMap[pDict] = fontData; 192 m_FontMap[pDict] = fontData;
193 return fontData->AddRef(); 193 return fontData->AddRef();
194 } 194 }
195 195
196 void CPDF_DocPageData::ReleaseFont(const CPDF_Dictionary* pFontDict) { 196 void CPDF_DocPageData::ReleaseFont(const CPDF_Dictionary* pFontDict) {
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 } 537 }
538 538
539 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr( 539 CPDF_CountedPattern* CPDF_DocPageData::FindPatternPtr(
540 CPDF_Object* pPatternObj) const { 540 CPDF_Object* pPatternObj) const {
541 if (!pPatternObj) 541 if (!pPatternObj)
542 return nullptr; 542 return nullptr;
543 543
544 auto it = m_PatternMap.find(pPatternObj); 544 auto it = m_PatternMap.find(pPatternObj);
545 return it != m_PatternMap.end() ? it->second : nullptr; 545 return it != m_PatternMap.end() ? it->second : nullptr;
546 } 546 }
OLDNEW
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/page/cpdf_image.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698