From 95061379c9453b941783398826acff674d2bbfd7 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 10 May 2018 16:38:15 +0000 Subject: Do not build BMP when codec is disabled Currently all of the BMP related code is being built when support for the codec is disabled, it just isn't being utilized. Depending on the settings being used, this unneeded code may or may not get stripped during linking. This CL explicitly turns off building the BMP codec code if support for BMP is turned off. BUG=pdfium:1080 Change-Id: I56d40639a5a3631f9c601a1eef3f98873feac94f Reviewed-on: https://pdfium-review.googlesource.com/32370 Commit-Queue: Ryan Harrison Reviewed-by: dsinclair --- core/fxcodec/codec/ccodec_progressivedecoder.h | 34 ++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'core/fxcodec/codec/ccodec_progressivedecoder.h') diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h index 07716a80ae..4eeb59d559 100644 --- a/core/fxcodec/codec/ccodec_progressivedecoder.h +++ b/core/fxcodec/codec/ccodec_progressivedecoder.h @@ -11,7 +11,6 @@ #include #include -#include "core/fxcodec/codec/ccodec_bmpmodule.h" #include "core/fxcodec/codec/ccodec_jpegmodule.h" #include "core/fxcodec/fx_codec_def.h" #include "core/fxcrt/fx_system.h" @@ -20,9 +19,13 @@ #include "core/fxge/dib/cfx_dibitmap.h" #include "core/fxge/fx_dib.h" +#ifdef PDF_ENABLE_XFA_BMP +#include "core/fxcodec/codec/ccodec_bmpmodule.h" +#endif // PDF_ENABLE_XFA_BMP + #ifdef PDF_ENABLE_XFA_GIF #include "core/fxcodec/codec/ccodec_gifmodule.h" -#endif // PDF_ENABLE_XFA_gif +#endif // PDF_ENABLE_XFA_GIF #ifdef PDF_ENABLE_XFA_PNG #include "core/fxcodec/codec/ccodec_pngmodule.h" @@ -38,14 +41,17 @@ class IFX_SeekableReadStream; class CCodec_Dummy {}; // Placeholder to work around C++ syntax issues -class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, +class CCodec_ProgressiveDecoder : +#ifdef PDF_ENABLE_XFA_BMP + public CCodec_BmpModule::Delegate, +#endif // PDF_ENABLE_XFA_BMP #ifdef PDF_ENABLE_XFA_GIF - public CCodec_GifModule::Delegate, + public CCodec_GifModule::Delegate, #endif // PDF_ENABLE_XFA_GIF #ifdef PDF_ENABLE_XFA_PNG - public CCodec_PngModule::Delegate, + public CCodec_PngModule::Delegate, #endif // PDF_ENABLE_XFA_PNG - public CCodec_Dummy { + public CCodec_Dummy { public: enum FXCodec_Format { FXCodec_Invalid = 0, @@ -166,17 +172,21 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, void GifReadScanline(int32_t row_num, uint8_t* row_buf) override; #endif // PDF_ENABLE_XFA_GIF +#ifdef PDF_ENABLE_XFA_BMP // CCodec_BmpModule::Delegate bool BmpInputImagePositionBuf(uint32_t rcd_pos) override; void BmpReadScanline(uint32_t row_num, const std::vector& row_buf) override; +#endif // PDF_ENABLE_XFA_BMP private: +#ifdef PDF_ENABLE_XFA_BMP bool BmpReadMoreData(CCodec_BmpModule* pBmpModule, FXCODEC_STATUS& err_status); bool BmpDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size); FXCODEC_STATUS BmpStartDecode(const RetainPtr& pDIBitmap); FXCODEC_STATUS BmpContinueDecode(); +#endif // PDF_ENABLE_XFA_BMP #ifdef PDF_ENABLE_XFA_GIF bool GifReadMoreData(CCodec_GifModule* pGifModule, @@ -234,14 +244,16 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, RetainPtr m_pFile; RetainPtr m_pDeviceBitmap; UnownedPtr m_pCodecMgr; +#ifdef PDF_ENABLE_XFA_BMP + std::unique_ptr m_pBmpContext; +#endif // PDF_ENABLE_XFA_BMP +#ifdef PDF_ENABLE_XFA_GIF + std::unique_ptr m_pGifContext; +#endif // PDF_ENABLE_XFA_GIF std::unique_ptr m_pJpegContext; #ifdef PDF_ENABLE_XFA_PNG std::unique_ptr m_pPngContext; #endif // PDF_ENABLE_XFA_PNG -#ifdef PDF_ENABLE_XFA_GIF - std::unique_ptr m_pGifContext; -#endif // PDF_ENABLE_XFA_GIF - std::unique_ptr m_pBmpContext; #ifdef PDF_ENABLE_XFA_TIFF std::unique_ptr m_pTiffContext; #endif // PDF_ENABLE_XFA_TIFF @@ -279,7 +291,9 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate, FX_RECT m_GifFrameRect; bool m_InvalidateGifBuffer; #endif // PDF_ENABLE_XFA_GIF +#ifdef PDF_ENABLE_XFA_BMP bool m_BmpIsTopBottom; +#endif // PDF_ENABLE_XFA_BMP FXCODEC_STATUS m_status; }; -- cgit v1.2.3