Chromium Code Reviews| Index: core/src/fxge/ge/fx_ge_text.cpp |
| diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp |
| index 0d4e9d53590ef41389e9d5eb54a99fefdbc41193..31d198df594e775af5d0719833f845258347f31b 100644 |
| --- a/core/src/fxge/ge/fx_ge_text.cpp |
| +++ b/core/src/fxge/ge/fx_ge_text.cpp |
| @@ -1232,15 +1232,13 @@ CFX_FaceCache::CFX_FaceCache(FXFT_Face face) { |
| m_Face = face; |
| } |
| CFX_FaceCache::~CFX_FaceCache() { |
| - FX_POSITION pos = m_SizeMap.GetStartPosition(); |
| - CFX_ByteString Key; |
| - CFX_SizeGlyphCache* pSizeCache = NULL; |
| - while (pos) { |
| - m_SizeMap.GetNextAssoc(pos, Key, (void*&)pSizeCache); |
| - delete pSizeCache; |
| + auto it = m_SizeMap.begin(); |
| + while (it != m_SizeMap.end()) { |
|
Lei Zhang
2015/08/15 00:35:44
Range-Based For Loop?
|
| + auto temp = it++; |
| + delete temp->second; |
| + m_SizeMap.erase(temp); |
| } |
| - m_SizeMap.RemoveAll(); |
| - pos = m_PathMap.GetStartPosition(); |
| + FX_POSITION pos = m_PathMap.GetStartPosition(); |
| void* key1; |
| CFX_PathData* pPath; |
| while (pos) { |
| @@ -1260,10 +1258,13 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap( |
| FX_BOOL bFontStyle, |
| int dest_width, |
| int anti_alias) { |
| - CFX_SizeGlyphCache* pSizeCache = NULL; |
| - if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { |
| + CFX_SizeGlyphCache* pSizeCache; |
| + auto it = m_SizeMap.find(FaceGlyphsKey); |
| + if (it == m_SizeMap.end()) { |
| pSizeCache = new CFX_SizeGlyphCache; |
| - m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); |
| + m_SizeMap[FaceGlyphsKey] = pSizeCache; |
| + } else { |
| + pSizeCache = it->second; |
| } |
| CFX_GlyphBitmap* pGlyphBitmap = NULL; |
| if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, |