summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/cpdf_pagerendercontext.cpp21
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_page.cpp6
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_page.h9
-rw-r--r--core/fpdfapi/include/cpdf_modulemgr.h18
-rw-r--r--core/fpdfapi/include/cpdf_pagerendercontext.h31
5 files changed, 78 insertions, 7 deletions
diff --git a/core/fpdfapi/cpdf_pagerendercontext.cpp b/core/fpdfapi/cpdf_pagerendercontext.cpp
new file mode 100644
index 0000000000..04ae3a8e33
--- /dev/null
+++ b/core/fpdfapi/cpdf_pagerendercontext.cpp
@@ -0,0 +1,21 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fpdfapi/include/cpdf_pagerendercontext.h"
+
+#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fpdfdoc/cpdf_annotlist.h"
+#include "core/fpdfdoc/include/fpdf_doc.h"
+#include "core/fxge/include/fx_ge.h"
+
+CPDF_PageRenderContext::CPDF_PageRenderContext() {}
+
+CPDF_PageRenderContext::~CPDF_PageRenderContext() {
+ if (m_pOptions)
+ delete m_pOptions->m_pOCContext;
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_page.cpp b/core/fpdfapi/fpdf_page/cpdf_page.cpp
index 441bbfe28b..289ef717c4 100644
--- a/core/fpdfapi/fpdf_page/cpdf_page.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_page.cpp
@@ -14,6 +14,7 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h"
#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
+#include "core/fpdfapi/include/cpdf_pagerendercontext.h"
#include "third_party/base/stl_util.h"
CPDF_Page::CPDF_Page(CPDF_Document* pDocument,
@@ -95,6 +96,11 @@ void CPDF_Page::ParseContent() {
ContinueParse(nullptr);
}
+void CPDF_Page::SetRenderContext(
+ std::unique_ptr<CPDF_PageRenderContext> pContext) {
+ m_pRenderContext = std::move(pContext);
+}
+
CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
CPDF_Dictionary* pPageDict = m_pFormDict;
std::set<CPDF_Dictionary*> visited;
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h
index e73c41db79..5be82d5451 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_page.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_page.h
@@ -18,6 +18,7 @@ class CPDF_Dictionary;
class CPDF_Document;
class CPDF_Object;
class CPDF_PageRenderCache;
+class CPDF_PageRenderContext;
class CPDF_Page : public CPDF_PageObjectHolder {
public:
@@ -44,10 +45,10 @@ class CPDF_Page : public CPDF_PageObjectHolder {
CPDF_Object* GetPageAttr(const CFX_ByteString& name) const;
CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender.get(); }
- CFX_Deletable* GetRenderContext() const { return m_pRenderContext.get(); }
- void SetRenderContext(std::unique_ptr<CFX_Deletable> pContext) {
- m_pRenderContext = std::move(pContext);
+ CPDF_PageRenderContext* GetRenderContext() const {
+ return m_pRenderContext.get();
}
+ void SetRenderContext(std::unique_ptr<CPDF_PageRenderContext> pContext);
View* GetView() const { return m_pView; }
void SetView(View* pView) { m_pView = pView; }
@@ -62,7 +63,7 @@ class CPDF_Page : public CPDF_PageObjectHolder {
CFX_Matrix m_PageMatrix;
View* m_pView;
std::unique_ptr<CPDF_PageRenderCache> m_pPageRender;
- std::unique_ptr<CFX_Deletable> m_pRenderContext;
+ std::unique_ptr<CPDF_PageRenderContext> m_pRenderContext;
};
#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_
diff --git a/core/fpdfapi/include/cpdf_modulemgr.h b/core/fpdfapi/include/cpdf_modulemgr.h
index 95c5385e64..6e00385480 100644
--- a/core/fpdfapi/include/cpdf_modulemgr.h
+++ b/core/fpdfapi/include/cpdf_modulemgr.h
@@ -20,6 +20,17 @@ class CCodec_JpxModule;
class CCodec_ModuleMgr;
class CPDF_PageModule;
+class CFSDK_UnsupportInfo_Adapter {
+ public:
+ explicit CFSDK_UnsupportInfo_Adapter(void* unsp_info)
+ : m_unsp_info(unsp_info) {}
+
+ void* GetUnspInfo() const { return m_unsp_info; }
+
+ private:
+ void* const m_unsp_info;
+};
+
class CPDF_ModuleMgr {
public:
static CPDF_ModuleMgr* Get();
@@ -33,10 +44,11 @@ class CPDF_ModuleMgr {
void InitPageModule();
CPDF_PageModule* GetPageModule() const { return m_pPageModule.get(); }
- void SetUnsupportInfoAdapter(std::unique_ptr<CFX_Deletable> pAdapter) {
+ void SetUnsupportInfoAdapter(
+ std::unique_ptr<CFSDK_UnsupportInfo_Adapter> pAdapter) {
m_pUnsupportInfoAdapter = std::move(pAdapter);
}
- CFX_Deletable* GetUnsupportInfoAdapter() const {
+ CFSDK_UnsupportInfo_Adapter* GetUnsupportInfoAdapter() const {
return m_pUnsupportInfoAdapter.get();
}
@@ -58,7 +70,7 @@ class CPDF_ModuleMgr {
CCodec_ModuleMgr* m_pCodecModule;
std::unique_ptr<CPDF_PageModule> m_pPageModule;
- std::unique_ptr<CFX_Deletable> m_pUnsupportInfoAdapter;
+ std::unique_ptr<CFSDK_UnsupportInfo_Adapter> m_pUnsupportInfoAdapter;
};
#endif // CORE_FPDFAPI_INCLUDE_CPDF_MODULEMGR_H_
diff --git a/core/fpdfapi/include/cpdf_pagerendercontext.h b/core/fpdfapi/include/cpdf_pagerendercontext.h
new file mode 100644
index 0000000000..2ee3daeda3
--- /dev/null
+++ b/core/fpdfapi/include/cpdf_pagerendercontext.h
@@ -0,0 +1,31 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FPDFAPI_INCLUDE_CPDF_PAGERENDERCONTEXT_H_
+#define CORE_FPDFAPI_INCLUDE_CPDF_PAGERENDERCONTEXT_H_
+
+#include <memory>
+
+class CFX_RenderDevice;
+class CPDF_AnnotList;
+class CPDF_ProgressiveRenderer;
+class CPDF_RenderContext;
+class CPDF_RenderOptions;
+
+// Everything about rendering is put here: for OOM recovery
+class CPDF_PageRenderContext {
+ public:
+ CPDF_PageRenderContext();
+ ~CPDF_PageRenderContext();
+
+ std::unique_ptr<CFX_RenderDevice> m_pDevice;
+ std::unique_ptr<CPDF_RenderContext> m_pContext;
+ std::unique_ptr<CPDF_ProgressiveRenderer> m_pRenderer;
+ std::unique_ptr<CPDF_AnnotList> m_pAnnots;
+ std::unique_ptr<CPDF_RenderOptions> m_pOptions;
+};
+
+#endif // CORE_FPDFAPI_INCLUDE_CPDF_PAGERENDERCONTEXT_H_