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 --- xfa/fxfa/cxfa_ffwidget.cpp | 2 ++ xfa/fxfa/parser/cxfa_node.cpp | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) (limited to 'xfa') diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index 3c5a3411a7..c9bb072cb9 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -40,7 +40,9 @@ FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type, int32_t iBitsPerComponent) { FXDIB_Format dibFormat = FXDIB_Argb; switch (type) { +#ifdef PDF_ENABLE_XFA_BMP case FXCODEC_IMAGE_BMP: +#endif // PDF_ENABLE_XFA_BMP case FXCODEC_IMAGE_JPG: #ifdef PDF_ENABLE_XFA_TIFF case FXCODEC_IMAGE_TIFF: diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index f178bd92a9..af3ad63f72 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -163,22 +163,30 @@ int32_t XFA_Base64Decode(const char* pStr, uint8_t* pOutBuffer) { FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) { WideString wsContentType(wsType); wsContentType.MakeLower(); + +#ifdef PDF_ENABLE_XFA_BMP + if (wsContentType == L"image/bmp") + return FXCODEC_IMAGE_BMP; +#endif // PDF_ENABLE_XFA_BMP + +#ifdef PDF_ENABLE_XFA_GIF + if (wsContentType == L"image/gif") + return FXCODEC_IMAGE_GIF; +#endif // PDF_ENABLE_XFA_GIF + if (wsContentType == L"image/jpg") return FXCODEC_IMAGE_JPG; + #ifdef PDF_ENABLE_XFA_PNG if (wsContentType == L"image/png") return FXCODEC_IMAGE_PNG; #endif // PDF_ENABLE_XFA_PNG -#ifdef PDF_ENABLE_XFA_GIF - if (wsContentType == L"image/gif") - return FXCODEC_IMAGE_GIF; -#endif // PDF_ENABLE_XFA_GIF - if (wsContentType == L"image/bmp") - return FXCODEC_IMAGE_BMP; + #ifdef PDF_ENABLE_XFA_TIFF if (wsContentType == L"image/tif") return FXCODEC_IMAGE_TIFF; #endif // PDF_ENABLE_XFA_TIFF + return FXCODEC_IMAGE_UNKNOWN; } -- cgit v1.2.3