From 830897a1774fb50d04b656d7bf70be321e133cf9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 11 May 2017 14:36:10 -0400 Subject: Move map and codec loading into manager This Cl consolidates the code to load maps and codecs into the CPDF_ModuleMgr class instead of putting it directly into fpdfview. Change-Id: Ia08f212f43a33e51ab1c7832051ee4f28eecb50d Reviewed-on: https://pdfium-review.googlesource.com/5335 Commit-Queue: dsinclair Reviewed-by: Tom Sepez --- core/fpdfapi/cpdf_modulemgr.cpp | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'core/fpdfapi/cpdf_modulemgr.cpp') diff --git a/core/fpdfapi/cpdf_modulemgr.cpp b/core/fpdfapi/cpdf_modulemgr.cpp index ac28b36663..8e39bdd587 100644 --- a/core/fpdfapi/cpdf_modulemgr.cpp +++ b/core/fpdfapi/cpdf_modulemgr.cpp @@ -10,6 +10,22 @@ #include "core/fxcodec/fx_codec.h" #include "third_party/base/ptr_util.h" +#ifdef PDF_ENABLE_XFA_BMP +#include "core/fxcodec/codec/ccodec_bmpmodule.h" +#endif + +#ifdef PDF_ENABLE_XFA_GIF +#include "core/fxcodec/codec/ccodec_gifmodule.h" +#endif + +#ifdef PDF_ENABLE_XFA_PNG +#include "core/fxcodec/codec/ccodec_pngmodule.h" +#endif + +#ifdef PDF_ENABLE_XFA_TIFF +#include "core/fxcodec/codec/ccodec_tiffmodule.h" +#endif + namespace { CPDF_ModuleMgr* g_pDefaultMgr = nullptr; @@ -33,6 +49,31 @@ CPDF_ModuleMgr::CPDF_ModuleMgr() : m_pCodecModule(nullptr) {} CPDF_ModuleMgr::~CPDF_ModuleMgr() {} +void CPDF_ModuleMgr::LoadEmbeddedMaps() { + LoadEmbeddedGB1CMaps(); + LoadEmbeddedJapan1CMaps(); + LoadEmbeddedCNS1CMaps(); + LoadEmbeddedKorea1CMaps(); +} + +void CPDF_ModuleMgr::LoadCodecModules() { +#ifdef PDF_ENABLE_XFA_BMP + m_pCodecModule->SetBmpModule(pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_GIF + m_pCodecModule->SetGifModule(pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_PNG + m_pCodecModule->SetPngModule(pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_TIFF + m_pCodecModule->SetTiffModule(pdfium::MakeUnique()); +#endif +} + void CPDF_ModuleMgr::InitPageModule() { m_pPageModule = pdfium::MakeUnique(); } -- cgit v1.2.3