summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/fx_codec_progress.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-09 21:06:22 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-09 21:06:22 +0000
commit607f3cd63a314cd3a6c219b19cce31805b66cd6d (patch)
tree74c9bff427b4c8f4697ee28b17bbebe2be411cb2 /core/fxcodec/codec/fx_codec_progress.cpp
parentd5d48457dabbe71e7f6b0baf2eaea6aa0dc86736 (diff)
downloadpdfium-607f3cd63a314cd3a6c219b19cce31805b66cd6d.tar.xz
Do not build GIF when codec is disabled
Currently all of the GIF 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 GIF codec code if support for GIF is turned off. This also catches a few missed cases from previous CLs. BUG=pdfium:1080 Change-Id: Ie7fe2d894d2ae2f8f36ae05e0ff256f2ce6ef8d4 Reviewed-on: https://pdfium-review.googlesource.com/32330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/fx_codec_progress.cpp')
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index bfd60acd0e..1d6bc708db 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -275,13 +275,15 @@ CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
m_FrameNumber = 0;
m_FrameCur = 0;
m_SrcPaletteNumber = 0;
+#ifdef PDF_ENABLE_XFA_GIF
m_GifPltNumber = 0;
m_GifBgIndex = 0;
m_pGifPalette = nullptr;
m_GifTransIndex = -1;
m_GifFrameRect = FX_RECT(0, 0, 0, 0);
- m_BmpIsTopBottom = false;
m_InvalidateGifBuffer = true;
+#endif // PDF_ENABLE_XFA_GIF
+ m_BmpIsTopBottom = false;
}
CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
@@ -450,6 +452,7 @@ void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass,
}
#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
void CCodec_ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) {
uint32_t remain_size =
m_pCodecMgr->GetGifModule()->GetAvailInput(m_pGifContext.get());
@@ -608,6 +611,7 @@ void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
if (bLastPass)
GifDoubleLineResampleVert(pDIBitmap, scale_y, dest_row);
}
+#endif // PDF_ENABLE_XFA_GIF
bool CCodec_ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) {
m_offSet = rcd_pos;
@@ -923,6 +927,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpContinueDecode() {
}
}
+#ifdef PDF_ENABLE_XFA_GIF
bool CCodec_ProgressiveDecoder::GifReadMoreData(CCodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status) {
if (static_cast<uint32_t>(m_pFile->GetSize()) <= m_offSet)
@@ -1151,6 +1156,7 @@ void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
GifDoubleLineResampleVert(pDeviceBitmap, scale_y, dest_row + (int)scale_y);
}
}
+#endif // PDF_ENABLE_XFA_GIF
bool CCodec_ProgressiveDecoder::JpegReadMoreData(CCodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status) {
@@ -1735,8 +1741,10 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
case FXCODEC_IMAGE_PNG:
return PngDetectImageType(pAttribute, size);
#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF:
return GifDetectImageType(pAttribute, size);
+#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_TIFF
case FXCODEC_IMAGE_TIFF:
return TiffDetectImageType(pAttribute, size);
@@ -2309,6 +2317,7 @@ std::pair<FXCODEC_STATUS, size_t> CCodec_ProgressiveDecoder::GetFrames() {
m_FrameNumber = 1;
m_status = FXCODEC_STATUS_DECODE_READY;
return {m_status, 1};
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF: {
CCodec_GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
@@ -2336,6 +2345,7 @@ std::pair<FXCODEC_STATUS, size_t> CCodec_ProgressiveDecoder::GetFrames() {
return {m_status, 0};
}
}
+#endif // PDF_ENABLE_XFA_GIF
default:
return {FXCODEC_STATUS_ERROR, 0};
}
@@ -2401,8 +2411,10 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
case FXCODEC_IMAGE_PNG:
return PngStartDecode(pDIBitmap);
#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF:
return GifStartDecode(pDIBitmap);
+#endif // PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_BMP:
return BmpStartDecode(pDIBitmap);
#ifdef PDF_ENABLE_XFA_TIFF
@@ -2426,8 +2438,10 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
case FXCODEC_IMAGE_PNG:
return PngContinueDecode();
#endif // PDF_ENABLE_XFA_PNG
+#ifdef PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_GIF:
return GifContinueDecode();
+#endif // PDF_ENABLE_XFA_GIF
case FXCODEC_IMAGE_BMP:
return BmpContinueDecode();
#ifdef PDF_ENABLE_XFA_TIFF