Allow building XFA without additional codecs.
This is something we'd like to try for initial XFA launches
adding in codecs as justified by results in the wild.
Adding statistics for the unsupported cases is a follow-up
exercise once this builds correctly.
We always build all the additional libraries, to allow
fuzzers to link against them even if we are not shipping
them. The linker will sort it out for the actual code.
Rename some files to match the classes contained within.
That the existing tests seem to pass with the codecs
disabled warrants further investigation.
Change-Id: Iad269db91289f12dc9f5dda8f48121d27a0c4367
Reviewed-on: https://pdfium-review.googlesource.com/2836
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index beb6ec3..dc15e9e 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -33,6 +33,18 @@
if (pdf_enable_xfa) {
defines += [ "PDF_ENABLE_XFA" ]
+ if (pdf_enable_xfa_bmp) {
+ defines += [ "PDF_ENABLE_XFA_BMP" ]
+ }
+ if (pdf_enable_xfa_gif) {
+ defines += [ "PDF_ENABLE_XFA_GIF" ]
+ }
+ if (pdf_enable_xfa_png) {
+ defines += [ "PDF_ENABLE_XFA_PNG" ]
+ }
+ if (pdf_enable_xfa_tiff) {
+ defines += [ "PDF_ENABLE_XFA_TIFF" ]
+ }
}
if (pdf_use_win32_gdi) {
@@ -687,16 +699,16 @@
if (pdf_enable_xfa) {
sources += [
+ "core/fxcodec/codec/ccodec_bmpmodule.cpp",
"core/fxcodec/codec/ccodec_bmpmodule.h",
+ "core/fxcodec/codec/ccodec_gifmodule.cpp",
"core/fxcodec/codec/ccodec_gifmodule.h",
+ "core/fxcodec/codec/ccodec_pngmodule.cpp",
"core/fxcodec/codec/ccodec_pngmodule.h",
"core/fxcodec/codec/ccodec_progressivedecoder.h",
+ "core/fxcodec/codec/ccodec_tiffmodule.cpp",
"core/fxcodec/codec/ccodec_tiffmodule.h",
- "core/fxcodec/codec/fx_codec_bmp.cpp",
- "core/fxcodec/codec/fx_codec_gif.cpp",
- "core/fxcodec/codec/fx_codec_png.cpp",
"core/fxcodec/codec/fx_codec_progress.cpp",
- "core/fxcodec/codec/fx_codec_tiff.cpp",
"core/fxcodec/lbmp/fx_bmp.cpp",
"core/fxcodec/lbmp/fx_bmp.h",
"core/fxcodec/lgif/fx_gif.cpp",
diff --git a/core/fxcodec/codec/fx_codec_bmp.cpp b/core/fxcodec/codec/ccodec_bmpmodule.cpp
similarity index 98%
rename from core/fxcodec/codec/fx_codec_bmp.cpp
rename to core/fxcodec/codec/ccodec_bmpmodule.cpp
index ae83d3f..c6ebd2d 100644
--- a/core/fxcodec/codec/fx_codec_bmp.cpp
+++ b/core/fxcodec/codec/ccodec_bmpmodule.cpp
@@ -4,10 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcodec/lbmp/fx_bmp.h"
#include "core/fxge/fx_dib.h"
+
struct FXBMP_Context {
bmp_decompress_struct_p bmp_ptr;
void* parent_ptr;
diff --git a/core/fxcodec/codec/fx_codec_gif.cpp b/core/fxcodec/codec/ccodec_gifmodule.cpp
similarity index 98%
rename from core/fxcodec/codec/fx_codec_gif.cpp
rename to core/fxcodec/codec/ccodec_gifmodule.cpp
index fadf18f..e3b2648 100644
--- a/core/fxcodec/codec/fx_codec_gif.cpp
+++ b/core/fxcodec/codec/ccodec_gifmodule.cpp
@@ -4,10 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fxcodec/codec/ccodec_gifmodule.h"
+
#include "core/fxcodec/codec/codec_int.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcodec/lgif/fx_gif.h"
#include "core/fxge/fx_dib.h"
+
struct FXGIF_Context {
gif_decompress_struct_p gif_ptr;
void* parent_ptr;
diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h
index fac621d..21ac92d 100644
--- a/core/fxcodec/codec/ccodec_gifmodule.h
+++ b/core/fxcodec/codec/ccodec_gifmodule.h
@@ -7,8 +7,10 @@
#ifndef CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_
#define CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_
+#include "core/fxcrt/fx_coordinates.h"
#include "core/fxcrt/fx_system.h"
+class CFX_DIBAttribute;
struct FXGIF_Context;
class CCodec_GifModule {
diff --git a/core/fxcodec/codec/fx_codec_png.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
similarity index 98%
rename from core/fxcodec/codec/fx_codec_png.cpp
rename to core/fxcodec/codec/ccodec_pngmodule.cpp
index 579c85b..d3e24cd 100644
--- a/core/fxcodec/codec/fx_codec_png.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fxcodec/codec/ccodec_pngmodule.h"
+
#include <algorithm>
#include "core/fxcodec/codec/codec_int.h"
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 614146f..e97d1b9 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -171,6 +171,7 @@
FXCODEC_STATUS m_status;
protected:
+#ifdef PDF_ENABLE_XFA_PNG
static bool PngReadHeaderFunc(void* pModule,
int width,
int height,
@@ -182,6 +183,9 @@
static void PngFillScanlineBufCompletedFunc(void* pModule,
int pass,
int line);
+#endif // PDF_ENABLE_XFA_PNG
+
+#ifdef PDF_ENABLE_XFA_GIF
static void GifRecordCurrentPositionCallback(void* pModule,
uint32_t& cur_pos);
static uint8_t* GifAskLocalPaletteBufCallback(void* pModule,
@@ -200,10 +204,25 @@
static void GifReadScanlineCallback(void* pModule,
int32_t row_num,
uint8_t* row_buf);
+ bool GifReadMoreData(CCodec_GifModule* pGifModule,
+ FXCODEC_STATUS& err_status);
+ void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
+ double scale_y,
+ int des_row);
+#endif // PDF_ENABLE_XFA_GIF
+
+#ifdef PDF_ENABLE_XFA_BMP
static bool BmpInputImagePositionBufCallback(void* pModule, uint32_t rcd_pos);
static void BmpReadScanlineCallback(void* pModule,
int32_t row_num,
uint8_t* row_buf);
+ void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
+ int32_t des_line,
+ uint8_t* src_scan,
+ FXCodec_Format src_format);
+ bool BmpReadMoreData(CCodec_BmpModule* pBmpModule,
+ FXCODEC_STATUS& err_status);
+#endif // PDF_ENABLE_XFA_BMP
bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
CFX_DIBAttribute* pAttribute);
@@ -220,17 +239,6 @@
void ResampleVert(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
bool JpegReadMoreData(CCodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status);
- void PngOneOneMapResampleHorz(CFX_DIBitmap* pDeviceBitmap,
- int32_t des_line,
- uint8_t* src_scan,
- FXCodec_Format src_format);
- bool GifReadMoreData(CCodec_GifModule* pGifModule,
- FXCODEC_STATUS& err_status);
- void GifDoubleLineResampleVert(CFX_DIBitmap* pDeviceBitmap,
- double scale_y,
- int des_row);
- bool BmpReadMoreData(CCodec_BmpModule* pBmpModule,
- FXCODEC_STATUS& err_status);
void ResampleVertBT(CFX_DIBitmap* pDeviceBitmap, double scale_y, int des_row);
};
diff --git a/core/fxcodec/codec/fx_codec_tiff.cpp b/core/fxcodec/codec/ccodec_tiffmodule.cpp
similarity index 99%
rename from core/fxcodec/codec/fx_codec_tiff.cpp
rename to core/fxcodec/codec/ccodec_tiffmodule.cpp
index 7818a34..7367728 100644
--- a/core/fxcodec/codec/fx_codec_tiff.cpp
+++ b/core/fxcodec/codec/ccodec_tiffmodule.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include "core/fxcodec/codec/ccodec_tiffmodule.h"
+
#include <limits>
#include "core/fxcodec/codec/codec_int.h"
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 3edf892..d9a36a6 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -24,12 +24,18 @@
m_pJpxModule(new CCodec_JpxModule),
m_pJbig2Module(new CCodec_Jbig2Module),
m_pIccModule(new CCodec_IccModule),
-#ifdef PDF_ENABLE_XFA
- m_pPngModule(new CCodec_PngModule),
- m_pGifModule(new CCodec_GifModule),
+#ifdef PDF_ENABLE_XFA_BMP
m_pBmpModule(new CCodec_BmpModule),
+#endif // PDF_ENABLE_XFA_BMP
+#ifdef PDF_ENABLE_XFA_GIF
+ m_pGifModule(new CCodec_GifModule),
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_PNG
+ m_pPngModule(new CCodec_PngModule),
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_TIFF
m_pTiffModule(new CCodec_TiffModule),
-#endif // PDF_ENABLE_XFA
+#endif // PDF_ENABLE_XFA_TIFF
m_pFlateModule(new CCodec_FlateModule) {
}
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index 4a1719f..e4996c8 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -17,11 +17,13 @@
namespace {
+#ifdef PDF_ENABLE_XFA_PNG
#if _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
const double kPngGamma = 1.7;
-#else
+#else // _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
const double kPngGamma = 2.2;
-#endif
+#endif // _FX_OS_ == _FX_MACOSX_ || _FX_OS_ == _FX_IOS_
+#endif // PDF_ENABLE_XFA_PNG
void RGB2BGR(uint8_t* buffer, int width = 1) {
if (buffer && width > 0) {
@@ -299,14 +301,22 @@
m_pFile = nullptr;
if (m_pJpegContext)
m_pCodecMgr->GetJpegModule()->Finish(m_pJpegContext);
- if (m_pPngContext)
- m_pCodecMgr->GetPngModule()->Finish(m_pPngContext);
- if (m_pGifContext)
- m_pCodecMgr->GetGifModule()->Finish(m_pGifContext);
+#ifdef PDF_ENABLE_XFA_BMP
if (m_pBmpContext)
m_pCodecMgr->GetBmpModule()->Finish(m_pBmpContext);
+#endif // PDF_ENABLE_XFA_BMP
+#ifdef PDF_ENABLE_XFA_GIF
+ if (m_pGifContext)
+ m_pCodecMgr->GetGifModule()->Finish(m_pGifContext);
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_PNG
+ if (m_pPngContext)
+ m_pCodecMgr->GetPngModule()->Finish(m_pPngContext);
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_TIFF
if (m_pTiffContext)
m_pCodecMgr->GetTiffModule()->DestroyDecoder(m_pTiffContext);
+#endif // PDF_ENABLE_XFA_TIFF
FX_Free(m_pSrcBuf);
FX_Free(m_pDecodeBuf);
FX_Free(m_pSrcPalette);
@@ -349,6 +359,7 @@
return true;
}
+#ifdef PDF_ENABLE_XFA_PNG
bool CCodec_ProgressiveDecoder::PngReadHeaderFunc(void* pModule,
int width,
int height,
@@ -584,7 +595,9 @@
}
}
}
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
@@ -874,7 +887,9 @@
GifDoubleLineResampleVert(pDeviceBitmap, scale_y, des_row + (int)scale_y);
}
}
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_BMP
bool CCodec_ProgressiveDecoder::BmpReadMoreData(CCodec_BmpModule* pBmpModule,
FXCODEC_STATUS& err_status) {
uint32_t dwSize = (uint32_t)m_pFile->GetSize();
@@ -954,6 +969,7 @@
}
pCodec->ResampleVertBT(pDIBitmap, scale_y, des_row);
}
+#endif // PDF_ENABLE_XFA_BMP
void CCodec_ProgressiveDecoder::ResampleVertBT(CFX_DIBitmap* pDeviceBitmap,
double scale_y,
@@ -1051,6 +1067,7 @@
FXSYS_memset(m_pSrcBuf, 0, size);
m_SrcSize = size;
switch (imageType) {
+#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP: {
CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
@@ -1106,6 +1123,7 @@
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
}
+#endif // PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_JPG: {
CCodec_JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
if (!pJpegModule) {
@@ -1149,6 +1167,7 @@
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
}
+#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG: {
CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
@@ -1211,6 +1230,8 @@
}
return true;
}
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
@@ -1263,6 +1284,8 @@
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
}
+#endif // PDF_XFA_ENABLE_GIF
+#ifdef PDF_ENABLE_XFA_TIFF
case FXCODEC_IMAGE_TIF: {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
@@ -1288,6 +1311,7 @@
}
return true;
}
+#endif // PDF_ENABLE_XFA_TIFF
default:
m_status = FXCODEC_STATUS_ERR_FORMAT;
return false;
@@ -1832,13 +1856,20 @@
return FXCODEC_STATUS_ERROR;
}
switch (m_imagType) {
- case FXCODEC_IMAGE_BMP:
case FXCODEC_IMAGE_JPG:
+#ifdef PDF_ENABLE_XFA_BMP
+ case FXCODEC_IMAGE_BMP:
+#endif
+#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG:
+#endif
+#ifdef PDF_ENABLE_XFA_TIFF
case FXCODEC_IMAGE_TIF:
+#endif
frames = m_FrameNumber = 1;
m_status = FXCODEC_STATUS_DECODE_READY;
return m_status;
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while (true) {
@@ -1868,6 +1899,7 @@
return m_status;
}
}
+#endif // PDF_ENABLE_XFA_GIF
default:
return FXCODEC_STATUS_ERROR;
}
@@ -1968,6 +2000,7 @@
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
}
+#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG: {
CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
@@ -2020,6 +2053,8 @@
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
}
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
@@ -2041,6 +2076,8 @@
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
}
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP: {
CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
@@ -2071,9 +2108,12 @@
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
}
+#endif // PDF_ENABLE_XFA_BMP
+#ifdef PDF_ENABLE_XFA_TIFF
case FXCODEC_IMAGE_TIF:
m_status = FXCODEC_STATUS_DECODE_TOBECONTINUE;
return m_status;
+#endif // PDF_ENABLE_XFA_TIFF
default:
return FXCODEC_STATUS_ERROR;
}
@@ -2116,6 +2156,7 @@
}
}
}
+#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG: {
CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
while (true) {
@@ -2160,6 +2201,8 @@
}
}
}
+#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
while (true) {
@@ -2191,6 +2234,8 @@
return m_status;
}
}
+#endif // PDF_ENABLE_XFA_GIF
+#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP: {
CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
while (true) {
@@ -2221,6 +2266,8 @@
return m_status;
}
};
+#endif // PDF_ENABLE_XFA_BMP
+#ifdef PDF_ENABLE_XFA_TIFF
case FXCODEC_IMAGE_TIF: {
CCodec_TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
bool ret = false;
@@ -2364,6 +2411,7 @@
m_status = FXCODEC_STATUS_DECODE_FINISH;
return m_status;
}
+#endif // PDF_ENABLE_XFA_TIFF
default:
return FXCODEC_STATUS_ERROR;
}
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index bb47665..a33e117 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -28,12 +28,23 @@
class CPDF_ColorSpace;
class CPDF_StreamAcc;
-#ifdef PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA_BMP
#include "core/fxcodec/codec/ccodec_bmpmodule.h"
-#include "core/fxcodec/codec/ccodec_gifmodule.h"
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
-#include "core/fxcodec/codec/ccodec_tiffmodule.h"
+#endif // PDF_ENABLE_XFA_BMP
+#ifdef PDF_ENABLE_XFA_GIF
+#include "core/fxcodec/codec/ccodec_gifmodule.h"
+#endif // PDF_ENABLE_XFA_GIF
+
+#ifdef PDF_ENABLE_XFA_PNG
+#include "core/fxcodec/codec/ccodec_pngmodule.h"
+#endif // PDF_ENABLE_XFA_PNG
+
+#ifdef PDF_ENABLE_XFA_TIFF
+#include "core/fxcodec/codec/ccodec_tiffmodule.h"
+#endif // PDF_ENABLE_XFA_TIFF
+
+#ifdef PDF_ENABLE_XFA
class CCodec_ProgressiveDecoder;
class CFX_DIBAttribute {
@@ -71,12 +82,24 @@
#ifdef PDF_ENABLE_XFA
CCodec_ProgressiveDecoder* CreateProgressiveDecoder();
- CCodec_PngModule* GetPngModule() const { return m_pPngModule.get(); }
- CCodec_GifModule* GetGifModule() const { return m_pGifModule.get(); }
- CCodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
- CCodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); }
#endif // PDF_ENABLE_XFA
+#ifdef PDF_ENABLE_XFA_BMP
+ CCodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
+#endif // PDF_ENABLE_XFA_BMP
+
+#ifdef PDF_ENABLE_XFA_GIF
+ CCodec_GifModule* GetGifModule() const { return m_pGifModule.get(); }
+#endif // PDF_ENABLE_XFA_GIF
+
+#ifdef PDF_ENABLE_XFA_PNG
+ CCodec_PngModule* GetPngModule() const { return m_pPngModule.get(); }
+#endif // PDF_ENABLE_XFA_PNG
+
+#ifdef PDF_ENABLE_XFA_TIFF
+ CCodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); }
+#endif // PDF_ENABLE_XFA_TIFF
+
protected:
std::unique_ptr<CCodec_BasicModule> m_pBasicModule;
std::unique_ptr<CCodec_FaxModule> m_pFaxModule;
@@ -85,12 +108,21 @@
std::unique_ptr<CCodec_Jbig2Module> m_pJbig2Module;
std::unique_ptr<CCodec_IccModule> m_pIccModule;
-#ifdef PDF_ENABLE_XFA
- std::unique_ptr<CCodec_PngModule> m_pPngModule;
- std::unique_ptr<CCodec_GifModule> m_pGifModule;
+#ifdef PDF_ENABLE_XFA_BMP
std::unique_ptr<CCodec_BmpModule> m_pBmpModule;
+#endif // PDF_ENABLE_XFA_BMP
+
+#ifdef PDF_ENABLE_XFA_GIF
+ std::unique_ptr<CCodec_GifModule> m_pGifModule;
+#endif // PDF_ENABLE_XFA_GIF
+
+#ifdef PDF_ENABLE_XFA_PNG
+ std::unique_ptr<CCodec_PngModule> m_pPngModule;
+#endif // PDF_ENABLE_XFA_PNG
+
+#ifdef PDF_ENABLE_XFA_TIFF
std::unique_ptr<CCodec_TiffModule> m_pTiffModule;
-#endif // PDF_ENABLE_XFA
+#endif // PDF_ENABLE_XFA_TIFF
std::unique_ptr<CCodec_FlateModule> m_pFlateModule;
};
diff --git a/pdfium.gni b/pdfium.gni
index 5737224..614ab91 100644
--- a/pdfium.gni
+++ b/pdfium.gni
@@ -17,6 +17,18 @@
# Build PDFium either with or without XFA Forms support.
pdf_enable_xfa = pdf_enable_xfa_override
+ # If XFA, also support bmp codec. Ignored if not XFA.
+ pdf_enable_xfa_bmp = false
+
+ # If XFA, also support gif codec. Ignored if not XFA.
+ pdf_enable_xfa_gif = false
+
+ # If XFA, also support png codec. Ignored if not XFA.
+ pdf_enable_xfa_png = false
+
+ # If XFA, also support png codec. Ignored if not XFA.
+ pdf_enable_xfa_tiff = false
+
# Build PDFium against skia (experimental) rather than agg. Use Skia to draw everything.
pdf_use_skia = pdf_use_skia_override