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

Unified Diff: core/src/fxge/android/fpf_skiafontmgr.cpp

Issue 1610163003: Merge to XFA: Replace more CFX_MapPtrToPtr. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fxge/android/fpf_skiafontmgr.h ('k') | pdfium.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxge/android/fpf_skiafontmgr.cpp
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index 9dbe35d0e515b082dbde54238128e7130993b07b..d4de2b812ee5e1a0b7a38d792792e1b9c6992013 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -219,14 +219,11 @@ CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(FALSE), m_FTLibrary(NULL) {}
CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
void* pkey = NULL;
CFPF_SkiaFont* pValue = NULL;
- FX_POSITION pos = m_FamilyFonts.GetStartPosition();
- while (pos) {
- m_FamilyFonts.GetNextAssoc(pos, pkey, (void*&)pValue);
- if (pValue) {
- pValue->Release();
- }
+ for (const auto& pair : m_FamilyFonts) {
+ if (pair.second)
+ pair.second->Release();
}
- m_FamilyFonts.RemoveAll();
+ m_FamilyFonts.clear();
for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) {
CFPF_SkiaFontDescriptor* pFont =
(CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(i);
@@ -259,12 +256,10 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
FX_DWORD dwStyle,
FX_DWORD dwMatch) {
FX_DWORD dwHash = FPF_SKIAGetFamilyHash(bsFamilyname, dwStyle, uCharset);
- IFPF_Font* pFont = NULL;
- if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) {
- if (pFont) {
- return pFont->Retain();
- }
- }
+ auto it = m_FamilyFonts.find(dwHash);
+ if (it != m_FamilyFonts.end() && it->second)
+ return it->second->Retain();
+
FX_DWORD dwFaceName = FPF_SKIANormalizeFontName(bsFamilyname);
FX_DWORD dwSubst = FPF_SkiaGetSubstFont(dwFaceName);
FX_DWORD dwSubstSans = FPF_SkiaGetSansFont(dwFaceName);
@@ -335,7 +330,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
(CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem);
CFPF_SkiaFont* pFont = new CFPF_SkiaFont;
if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) {
- m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont);
+ m_FamilyFonts[dwHash] = pFont;
return pFont->Retain();
}
pFont->Release();
« no previous file with comments | « core/src/fxge/android/fpf_skiafontmgr.h ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698