From b4a261855b34b4c8d938118762ae609a34a3ae99 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 1 Mar 2017 12:15:00 -0800 Subject: Create virtual codec APIs so chrome/fuzzers can link separately The one step to make an actual concrete class is conditionalized in fpdfview and is unconditional in the fuzzer. Also replace the clumsy C-style callbacks with a delegate interface as long as we are making new interfaces. Change-Id: I733a437483ce5e0c34211cfbbda05105336f55b5 Reviewed-on: https://pdfium-review.googlesource.com/2887 Commit-Queue: Tom Sepez Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/fpdfview.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'fpdfsdk/fpdfview.cpp') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index e1fba8df66..1e7a651aa8 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -44,6 +44,22 @@ #include "xfa/fxbarcode/BC_Library.h" #endif // PDF_ENABLE_XFA +#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 + #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #include "core/fxge/cfx_windowsdevice.h" #endif @@ -364,6 +380,26 @@ FPDF_InitLibraryWithConfig(const FPDF_LIBRARY_CONFIG* cfg) { pModuleMgr->LoadEmbeddedCNS1CMaps(); pModuleMgr->LoadEmbeddedKorea1CMaps(); +#ifdef PDF_ENABLE_XFA_BMP + pModuleMgr->GetCodecModule()->SetBmpModule( + pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_GIF + pModuleMgr->GetCodecModule()->SetGifModule( + pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_PNG + pModuleMgr->GetCodecModule()->SetPngModule( + pdfium::MakeUnique()); +#endif + +#ifdef PDF_ENABLE_XFA_TIFF + pModuleMgr->GetCodecModule()->SetTiffModule( + pdfium::MakeUnique()); +#endif + #ifdef PDF_ENABLE_XFA FXJSE_Initialize(); BC_Library_Init(); -- cgit v1.2.3