summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_colorspace.cpp1
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp19
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_pagemodule.h37
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp66
4 files changed, 58 insertions, 65 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
index aa31f9cbac..32e2945818 100644
--- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp
@@ -6,6 +6,7 @@
#include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h"
+#include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
diff --git a/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp b/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp
new file mode 100644
index 0000000000..0d2f547835
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_pagemodule.cpp
@@ -0,0 +1,19 @@
+// 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/fpdf_page/cpdf_pagemodule.h"
+
+CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) {
+ if (family == PDFCS_DEVICEGRAY)
+ return &m_StockGrayCS;
+ if (family == PDFCS_DEVICERGB)
+ return &m_StockRGBCS;
+ if (family == PDFCS_DEVICECMYK)
+ return &m_StockCMYKCS;
+ if (family == PDFCS_PATTERN)
+ return &m_StockPatternCS;
+ return nullptr;
+}
diff --git a/core/fpdfapi/fpdf_page/cpdf_pagemodule.h b/core/fpdfapi/fpdf_page/cpdf_pagemodule.h
new file mode 100644
index 0000000000..c609de9c58
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/cpdf_pagemodule.h
@@ -0,0 +1,37 @@
+// 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_FPDF_PAGE_CPDF_PAGEMODULE_H_
+#define CORE_FPDFAPI_FPDF_PAGE_CPDF_PAGEMODULE_H_
+
+#include "core/fpdfapi/fpdf_font/font_int.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_colorspace.h"
+#include "core/fpdfapi/fpdf_page/pageint.h"
+
+class CPDF_Document;
+
+class CPDF_PageModule {
+ public:
+ CPDF_PageModule()
+ : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY),
+ m_StockRGBCS(nullptr, PDFCS_DEVICERGB),
+ m_StockCMYKCS(nullptr, PDFCS_DEVICECMYK),
+ m_StockPatternCS(nullptr) {}
+ ~CPDF_PageModule() {}
+
+ CPDF_FontGlobals* GetFontGlobals() { return &m_FontGlobals; }
+ CPDF_ColorSpace* GetStockCS(int family);
+ void ClearStockFont(CPDF_Document* pDoc) { m_FontGlobals.Clear(pDoc); }
+
+ private:
+ CPDF_FontGlobals m_FontGlobals;
+ CPDF_DeviceCS m_StockGrayCS;
+ CPDF_DeviceCS m_StockRGBCS;
+ CPDF_DeviceCS m_StockCMYKCS;
+ CPDF_PatternCS m_StockPatternCS;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_PAGEMODULE_H_
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index aed6e1e05c..14621fc2b3 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -9,6 +9,7 @@
#include "core/fdrm/crypto/include/fx_crypt.h"
#include "core/fpdfapi/fpdf_font/cpdf_type1font.h"
#include "core/fpdfapi/fpdf_font/font_int.h"
+#include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h"
#include "core/fpdfapi/fpdf_page/cpdf_pattern.h"
#include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
#include "core/fpdfapi/fpdf_page/cpdf_tilingpattern.h"
@@ -18,76 +19,11 @@
#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
-#include "core/fpdfapi/ipdf_pagemodule.h"
-
-namespace {
-
-class CPDF_PageModule : public IPDF_PageModule {
- public:
- CPDF_PageModule()
- : m_StockGrayCS(nullptr, PDFCS_DEVICEGRAY),
- m_StockRGBCS(nullptr, PDFCS_DEVICERGB),
- m_StockCMYKCS(nullptr, PDFCS_DEVICECMYK),
- m_StockPatternCS(nullptr) {}
-
- private:
- ~CPDF_PageModule() override {}
-
- CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) override {
- return new CPDF_DocPageData(pDoc);
- }
-
- void ReleaseDoc(CPDF_Document* pDoc) override;
- void ClearDoc(CPDF_Document* pDoc) override;
-
- CPDF_FontGlobals* GetFontGlobals() override { return &m_FontGlobals; }
-
- void ClearStockFont(CPDF_Document* pDoc) override {
- m_FontGlobals.Clear(pDoc);
- }
-
- CPDF_ColorSpace* GetStockCS(int family) override;
- void NotifyCJKAvailable() override;
-
- CPDF_FontGlobals m_FontGlobals;
- CPDF_DeviceCS m_StockGrayCS;
- CPDF_DeviceCS m_StockRGBCS;
- CPDF_DeviceCS m_StockCMYKCS;
- CPDF_PatternCS m_StockPatternCS;
-};
-
-} // namespace
-
-CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) {
- if (family == PDFCS_DEVICEGRAY) {
- return &m_StockGrayCS;
- }
- if (family == PDFCS_DEVICERGB) {
- return &m_StockRGBCS;
- }
- if (family == PDFCS_DEVICECMYK) {
- return &m_StockCMYKCS;
- }
- if (family == PDFCS_PATTERN) {
- return &m_StockPatternCS;
- }
- return NULL;
-}
void CPDF_ModuleMgr::InitPageModule() {
m_pPageModule.reset(new CPDF_PageModule);
}
-void CPDF_PageModule::ReleaseDoc(CPDF_Document* pDoc) {
- delete pDoc->GetPageData();
-}
-void CPDF_PageModule::ClearDoc(CPDF_Document* pDoc) {
- pDoc->GetPageData()->Clear(FALSE);
-}
-void CPDF_PageModule::NotifyCJKAvailable() {
- m_FontGlobals.m_CMapManager.ReloadAll();
-}
-
CPDF_Font* CPDF_Document::LoadFont(CPDF_Dictionary* pFontDict) {
ASSERT(pFontDict);
return GetValidatePageData()->GetFont(pFontDict, FALSE);