diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-04-03 14:51:26 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-04-03 21:52:09 +0000 |
commit | 05e6a807311df5c3dfc4cafa56b85614f9bae6d3 (patch) | |
tree | 42abc36d38fe479e7b32c13b401c53cb3bd13be3 /core/fpdfapi/render/cpdf_renderstatus.cpp | |
parent | 3a1d9b48cb5485cdb93f1cc9857e5d829868629c (diff) | |
download | pdfium-05e6a807311df5c3dfc4cafa56b85614f9bae6d3.tar.xz |
RefCount CPDF_Type3Cache all the time.chromium/3062
Prefer internal refcounts to external scheme.
Change-Id: Ia99d5fc635a51a38f41b1d64ea44d8202685ddc7
Reviewed-on: https://pdfium-review.googlesource.com/3617
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/render/cpdf_renderstatus.cpp')
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index 69293e6ed3..09e5bc1433 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -66,11 +66,12 @@ namespace { void ReleaseCachedType3(CPDF_Type3Font* pFont) { - if (!pFont->m_pDocument) + CPDF_Document* pDoc = pFont->m_pDocument; + if (!pDoc) return; - pFont->m_pDocument->GetRenderData()->ReleaseCachedType3(pFont); - pFont->m_pDocument->GetPageData()->ReleaseFont(pFont->GetFontDict()); + pDoc->GetRenderData()->MaybePurgeCachedType3(pFont); + pDoc->GetPageData()->ReleaseFont(pFont->GetFontDict()); } class CPDF_RefType3Cache { @@ -1795,12 +1796,14 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, &text_matrix, fill_argb, &m_Options); } -CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) { - if (!pFont->m_pDocument) { +CFX_RetainPtr<CPDF_Type3Cache> CPDF_RenderStatus::GetCachedType3( + CPDF_Type3Font* pFont) { + CPDF_Document* pDoc = pFont->m_pDocument; + if (!pDoc) return nullptr; - } - pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict()); - return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont); + + pDoc->GetPageData()->GetFont(pFont->GetFontDict()); + return pDoc->GetRenderData()->GetCachedType3(pFont); } // TODO(npm): Font fallback for type 3 fonts? (Completely separate code!!) @@ -1902,7 +1905,7 @@ bool CPDF_RenderStatus::ProcessType3Text(CPDF_TextObject* textobj, delete pStates; } else if (pType3Char->m_pBitmap) { if (device_class == FXDC_DISPLAY) { - CPDF_Type3Cache* pCache = GetCachedType3(pType3Font); + CFX_RetainPtr<CPDF_Type3Cache> pCache = GetCachedType3(pType3Font); refTypeCache.m_dwCount++; CFX_GlyphBitmap* pBitmap = pCache->LoadGlyph(charcode, &matrix, sa, sd); if (!pBitmap) |