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

Unified Diff: core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp

Issue 1520643002: Replace several more CFX_MapPtrToPtr with std::set or std::map (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years 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
Index: core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 8cfa8dc4fbc2f83d92391a93de59917f9b4d1f98..dcb50beb99958bf41daffc833af932945e608795 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -34,24 +34,18 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode,
} else {
pSizeCache = it->second;
}
- CFX_GlyphBitmap* pGlyphBitmap;
- if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)charcode,
- (void*&)pGlyphBitmap)) {
- return pGlyphBitmap;
- }
- pGlyphBitmap =
+ auto it2 = pSizeCache->m_GlyphMap.find(charcode);
+ if (it2 != pSizeCache->m_GlyphMap.end())
+ return it2->second;
+
+ CFX_GlyphBitmap* pGlyphBitmap =
RenderGlyph(pSizeCache, charcode, pMatrix, retinaScaleX, retinaScaleY);
- pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)charcode, pGlyphBitmap);
+ pSizeCache->m_GlyphMap[charcode] = pGlyphBitmap;
return pGlyphBitmap;
}
CPDF_Type3Glyphs::~CPDF_Type3Glyphs() {
- FX_POSITION pos = m_GlyphMap.GetStartPosition();
- void* Key;
- CFX_GlyphBitmap* pGlyphBitmap;
- while (pos) {
- m_GlyphMap.GetNextAssoc(pos, Key, (void*&)pGlyphBitmap);
- delete pGlyphBitmap;
- }
+ for (const auto& pair : m_GlyphMap)
+ delete pair.second;
}
static int _AdjustBlue(FX_FLOAT pos, int& count, int blues[]) {
FX_FLOAT min_distance = 1000000.0f * 1.0f;

Powered by Google App Engine
This is Rietveld 408576698