summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_gefont.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-02 09:47:08 -0800
committerChromium commit bot <commit-bot@chromium.org>2017-03-02 18:57:52 +0000
commit4df55209c2f922f33c2f69fadfff5d30026e89d2 (patch)
tree75d6daefb1f8355d64799378f3bb0088a11f4187 /xfa/fgas/font/cfgas_gefont.cpp
parent9642d924668222ee06eb897761646dd964bd5a29 (diff)
downloadpdfium-4df55209c2f922f33c2f69fadfff5d30026e89d2.tar.xz
Remove CFX_MassArrayTemplate<CFX_Rect> backing array.
The map is one-to-one, so no need for a pointer to an externally stored rect. Change-Id: I4cd6f728cdadeb4c7b25b6f34f5d50bb5db89623 Reviewed-on: https://pdfium-review.googlesource.com/2896 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_gefont.cpp')
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp41
1 files changed, 17 insertions, 24 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index a175202e7d..a57962d084 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -220,8 +220,6 @@ bool CFGAS_GEFont::InitFont() {
m_pCharWidthMap =
pdfium::MakeUnique<CFX_DiscreteArrayTemplate<uint16_t>>(1024);
}
- if (!m_pRectArray)
- m_pRectArray = pdfium::MakeUnique<CFX_MassArrayTemplate<CFX_Rect>>(16);
return true;
}
@@ -315,32 +313,27 @@ bool CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode,
CFX_Rect* bbox,
bool bRecursive,
bool bCharCode) {
- ASSERT(m_pRectArray);
- CFX_Rect* pRect = nullptr;
auto it = m_BBoxMap.find(wUnicode);
- if (it == m_BBoxMap.end()) {
- CFX_RetainPtr<CFGAS_GEFont> pFont;
- int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode);
- if (iGlyph != 0xFFFF && pFont) {
- if (pFont.Get() == this) {
- FX_RECT rtBBox;
- if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) {
- CFX_Rect rt(rtBBox.left, rtBBox.top, rtBBox.Width(), rtBBox.Height());
- int32_t index = m_pRectArray->Add(rt);
- pRect = m_pRectArray->GetPtrAt(index);
- m_BBoxMap[wUnicode] = pRect;
- }
- } else if (pFont->GetCharBBoxInternal(wUnicode, bbox, false, bCharCode)) {
- return true;
- }
- }
- } else {
- pRect = it->second;
+ if (it != m_BBoxMap.end()) {
+ *bbox = it->second;
+ return true;
}
- if (!pRect)
+
+ CFX_RetainPtr<CFGAS_GEFont> pFont;
+ int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode);
+ if (!pFont || iGlyph == 0xFFFF)
+ return false;
+
+ if (pFont.Get() != this)
+ return pFont->GetCharBBoxInternal(wUnicode, bbox, false, bCharCode);
+
+ FX_RECT rtBBox;
+ if (!m_pFont->GetGlyphBBox(iGlyph, rtBBox))
return false;
- *bbox = *pRect;
+ CFX_Rect rt(rtBBox.left, rtBBox.top, rtBBox.Width(), rtBBox.Height());
+ m_BBoxMap[wUnicode] = rt;
+ *bbox = rt;
return true;
}