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

Side by Side Diff: core/src/fpdfapi/fpdf_font/ttgsubtable.cpp

Issue 1540263003: Add ContainsKey() and ContainsValue() and use them where appropriate. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 4 years, 12 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 "ttgsubtable.h" 7 #include "ttgsubtable.h"
8 8
9 #include "core/include/fxge/fx_freetype.h" 9 #include "core/include/fxge/fx_freetype.h"
10 #include "core/include/fxge/fx_ge.h" 10 #include "core/include/fxge/fx_ge.h"
11 #include "third_party/base/nonstd_unique_ptr.h" 11 #include "third_party/base/nonstd_unique_ptr.h"
12 #include "third_party/base/stl_util.h"
12 13
13 CFX_GlyphMap::CFX_GlyphMap() {} 14 CFX_GlyphMap::CFX_GlyphMap() {}
14 CFX_GlyphMap::~CFX_GlyphMap() {} 15 CFX_GlyphMap::~CFX_GlyphMap() {}
15 extern "C" { 16 extern "C" {
16 static int _CompareInt(const void* p1, const void* p2) { 17 static int _CompareInt(const void* p1, const void* p2) {
17 return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2); 18 return (*(FX_DWORD*)p1) - (*(FX_DWORD*)p2);
18 } 19 }
19 }; 20 };
20 struct _IntPair { 21 struct _IntPair {
21 int32_t key; 22 int32_t key;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for (int k = 0; 80 for (int k = 0;
80 k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) 81 k < ((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)
81 ->LangSys.FeatureCount; 82 ->LangSys.FeatureCount;
82 ++k) { 83 ++k) {
83 FX_DWORD index = 84 FX_DWORD index =
84 *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j) 85 *(((ScriptList.ScriptRecord + i)->Script.LangSysRecord + j)
85 ->LangSys.FeatureIndex + 86 ->LangSys.FeatureIndex +
86 k); 87 k);
87 if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] || 88 if (FeatureList.FeatureRecord[index].FeatureTag == tag[0] ||
88 FeatureList.FeatureRecord[index].FeatureTag == tag[1]) { 89 FeatureList.FeatureRecord[index].FeatureTag == tag[1]) {
89 if (m_featureMap.find(index) == m_featureMap.end()) { 90 if (!pdfium::ContainsKey(m_featureMap, index)) {
90 m_featureMap[index] = index; 91 m_featureMap[index] = index;
91 } 92 }
92 } 93 }
93 } 94 }
94 } 95 }
95 } 96 }
96 if (m_featureMap.empty()) { 97 if (m_featureMap.empty()) {
97 for (int i = 0; i < FeatureList.FeatureCount; i++) { 98 for (int i = 0; i < FeatureList.FeatureCount; i++) {
98 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] || 99 if (FeatureList.FeatureRecord[i].FeatureTag == tag[0] ||
99 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) { 100 FeatureList.FeatureRecord[i].FeatureTag == tag[1]) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, 405 FXFT_Load_Sfnt_Table(pFont->GetFace(), FT_MAKE_TAG('G', 'S', 'U', 'B'), 0,
405 pFont->GetSubData(), NULL); 406 pFont->GetSubData(), NULL);
406 if (!error && pFont->GetSubData()) { 407 if (!error && pFont->GetSubData()) {
407 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable); 408 nonstd::unique_ptr<CFX_GSUBTable> pGsubTable(new CFX_GSUBTable);
408 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) { 409 if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->GetSubData())) {
409 return pGsubTable.release(); 410 return pGsubTable.release();
410 } 411 }
411 } 412 }
412 return NULL; 413 return NULL;
413 } 414 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_font/fpdf_font.cpp ('k') | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698