summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_ocg.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 15:09:45 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 15:09:45 -0700
commite8d3691c82d1be805ffdce3329d00313af7ce0ab (patch)
tree39c6aeb956cc865e8f0b88ddcd80d1dd9e4285f7 /core/src/fpdfdoc/doc_ocg.cpp
parentcfac954abcab7caf47d3fa3d641c553cba998271 (diff)
downloadpdfium-e8d3691c82d1be805ffdce3329d00313af7ce0ab.tar.xz
Replace CFX_MapPtrTemplate with std::map.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1181593003.
Diffstat (limited to 'core/src/fpdfdoc/doc_ocg.cpp')
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index 601b006f1a..8477cb85d0 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -99,7 +99,7 @@ CPDF_OCContext::CPDF_OCContext(CPDF_Document *pDoc, UsageType eUsageType)
}
CPDF_OCContext::~CPDF_OCContext()
{
- m_OCGStates.RemoveAll();
+ m_OCGStates.clear();
}
FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, const CPDF_Dictionary *pOCGDict, FX_BOOL &bValidConfig) const
{
@@ -174,19 +174,21 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary *pOCGDict) const
FX_BOOL bDefValid = FALSE;
return LoadOCGStateFromConfig(csState, pOCGDict, bDefValid);
}
-FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict)
+
+FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict)
{
- if (!pOCGDict) {
+ if (!pOCGDict)
return FALSE;
- }
- void* bState = NULL;
- if (m_OCGStates.Lookup(pOCGDict, bState)) {
- return (uintptr_t)bState != 0;
- }
- bState = (void*)(uintptr_t)LoadOCGState(pOCGDict);
- m_OCGStates.SetAt(pOCGDict, bState);
- return (uintptr_t)bState != 0;
+
+ const auto it = m_OCGStates.find(pOCGDict);
+ if (it != m_OCGStates.end())
+ return it->second;
+
+ FX_BOOL bState = LoadOCGState(pOCGDict);
+ m_OCGStates[pOCGDict] = bState;
+ return bState;
}
+
FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel)
{
if (nLevel > 32) {
@@ -296,5 +298,5 @@ FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary *pOCGDict)
}
void CPDF_OCContext::ResetOCContext()
{
- m_OCGStates.RemoveAll();
+ m_OCGStates.clear();
}