summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
committerTom Sepez <tsepez@chromium.org>2015-08-19 09:49:24 -0700
commit09d33bcd82a82cb55039d41651df13e17d6c3e59 (patch)
tree7a748b7570ff6ad0321c4334319bac101da0e6af /core/src/fpdfapi/fpdf_render
parent1b0023986bc22ce362097b25deb9746b693ef235 (diff)
downloadpdfium-09d33bcd82a82cb55039d41651df13e17d6c3e59.tar.xz
Merge to XFA: CFX_MapByteStringToPtr considered harmful (combo patch).
New manual edits: two unused members deleted, one adapted. fde_csscache.cpp fde_csscache.h fpdfxfa_doc.h fx_ge_fontmap.cpp (cherry picked from commit 1d9dbd53b205b2b4d9e75a7eeb95e80837917ea3) (cherry picked from commit cb4d0ea68308e3c51a6ba9551b393bb2f639afc4) (cherry picked from commit 9cf44c2ed09a8b2ff243eb6dbb72a8cceae1b5ff) (cherry picked from commit 2a2a6aa7f51352fc481e78f6ad9d41f2738bcc48) (cherry picked from commit ce4ffb8183af3fa2bb5133f0f7370a88e064c516) Original Review URL: https://codereview.chromium.org/1297723002 . R=thestig@chromium.org Review URL: https://codereview.chromium.org/1301793002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_render')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp19
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h11
2 files changed, 16 insertions, 14 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index d36125e1b8..50388332f8 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -11,14 +11,10 @@
#include "render_int.h"
extern FX_BOOL IsAvailableMatrix(const CFX_AffineMatrix& matrix);
CPDF_Type3Cache::~CPDF_Type3Cache() {
- FX_POSITION pos = m_SizeMap.GetStartPosition();
- CFX_ByteString Key;
- CPDF_Type3Glyphs* pSizeCache = NULL;
- while (pos) {
- pSizeCache = (CPDF_Type3Glyphs*)m_SizeMap.GetNextValue(pos);
- delete pSizeCache;
+ for (const auto& pair : m_SizeMap) {
+ delete pair.second;
}
- m_SizeMap.RemoveAll();
+ m_SizeMap.clear();
}
CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode,
const CFX_AffineMatrix* pMatrix,
@@ -29,10 +25,13 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode,
4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000),
FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000));
CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
- CPDF_Type3Glyphs* pSizeCache = NULL;
- if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
+ CPDF_Type3Glyphs* pSizeCache;
+ auto it = m_SizeMap.find(FaceGlyphsKey);
+ if (it == m_SizeMap.end()) {
pSizeCache = new CPDF_Type3Glyphs;
- m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
+ m_SizeMap[FaceGlyphsKey] = pSizeCache;
+ } else {
+ pSizeCache = it->second;
}
CFX_GlyphBitmap* pGlyphBitmap;
if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)charcode,
diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h
index 733e24cbcf..e195472ac1 100644
--- a/core/src/fpdfapi/fpdf_render/render_int.h
+++ b/core/src/fpdfapi/fpdf_render/render_int.h
@@ -12,8 +12,11 @@
#include "../../../../third_party/base/nonstd_unique_ptr.h"
#include "../../../include/fpdfapi/fpdf_pageobj.h"
+class CFX_GlyphBitmap;
class CPDF_QuickStretcher;
+
#define TYPE3_MAX_BLUES 16
+
class CPDF_Type3Glyphs {
public:
CPDF_Type3Glyphs() {
@@ -30,11 +33,11 @@ class CPDF_Type3Glyphs {
int m_TopBlue[TYPE3_MAX_BLUES], m_BottomBlue[TYPE3_MAX_BLUES];
int m_TopBlueCount, m_BottomBlueCount;
};
-class CFX_GlyphBitmap;
class CPDF_Type3Cache {
public:
- CPDF_Type3Cache(CPDF_Type3Font* pFont) { m_pFont = pFont; }
+ explicit CPDF_Type3Cache(CPDF_Type3Font* pFont) : m_pFont(pFont) {}
~CPDF_Type3Cache();
+
CFX_GlyphBitmap* LoadGlyph(FX_DWORD charcode,
const CFX_AffineMatrix* pMatrix,
FX_FLOAT retinaScaleX = 1.0f,
@@ -46,8 +49,8 @@ class CPDF_Type3Cache {
const CFX_AffineMatrix* pMatrix,
FX_FLOAT retinaScaleX = 1.0f,
FX_FLOAT retinaScaleY = 1.0f);
- CPDF_Type3Font* m_pFont;
- CFX_MapByteStringToPtr m_SizeMap;
+ CPDF_Type3Font* const m_pFont;
+ std::map<CFX_ByteString, CPDF_Type3Glyphs*> m_SizeMap;
};
class CPDF_TransferFunc {
public: