summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp2
-rw-r--r--core/fpdfdoc/cpdf_occontext.h12
2 files changed, 9 insertions, 5 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 1ad6ab23a6..b1bc4c9ca9 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -126,7 +126,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
continue;
if (pOptions) {
- CPDF_OCContext* pOCContext = pOptions->m_pOCContext;
+ CFX_RetainPtr<CPDF_OCContext> pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext && pAnnotDict &&
!pOCContext->CheckOCGVisible(pAnnotDict->GetDictFor("OC"))) {
diff --git a/core/fpdfdoc/cpdf_occontext.h b/core/fpdfdoc/cpdf_occontext.h
index 49bbd76d0c..ecdcfae31b 100644
--- a/core/fpdfdoc/cpdf_occontext.h
+++ b/core/fpdfdoc/cpdf_occontext.h
@@ -9,6 +9,7 @@
#include <unordered_map>
+#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_string.h"
class CPDF_Array;
@@ -16,17 +17,20 @@ class CPDF_Dictionary;
class CPDF_Document;
class CPDF_PageObject;
-class CPDF_OCContext {
+class CPDF_OCContext : public CFX_Retainable {
public:
- enum UsageType { View = 0, Design, Print, Export };
+ template <typename T, typename... Args>
+ friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
- CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType);
- ~CPDF_OCContext();
+ enum UsageType { View = 0, Design, Print, Export };
bool CheckOCGVisible(const CPDF_Dictionary* pOCGDict);
bool CheckObjectVisible(const CPDF_PageObject* pObj);
private:
+ CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType);
+ ~CPDF_OCContext() override;
+
bool LoadOCGStateFromConfig(const CFX_ByteString& csConfig,
const CPDF_Dictionary* pOCGDict) const;
bool LoadOCGState(const CPDF_Dictionary* pOCGDict) const;