summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
commit606346f584700bdae0741066f2e6d2481744032c (patch)
tree8f6afe79644cc515795af83dc8a06b207afb1bd6 /core/src/fpdfdoc
parent6d8b1c2c7b1cbada20109f70ae971a4192330bb5 (diff)
downloadpdfium-606346f584700bdae0741066f2e6d2481744032c.tar.xz
Merge to XFA: Replace some CFX_MapPtrTemplates with std::map.
There are more CFX_MapPtrTemplate usage on the XFA branch, so it is not removed. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1181593003. (cherry picked from commit e8d3691c82d1be805ffdce3329d00313af7ce0ab) Review URL: https://codereview.chromium.org/1198663004.
Diffstat (limited to 'core/src/fpdfdoc')
-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();
}