summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_progressivedecoder.h
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-05-09 20:31:12 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-09 20:31:12 +0000
commitd5d48457dabbe71e7f6b0baf2eaea6aa0dc86736 (patch)
tree5694486d6c11a60a0ce602759c3c1e07c63b46fc /core/fxcodec/codec/ccodec_progressivedecoder.h
parent54ef2cb9eb5b145c6e973e95ccb488e121556ad7 (diff)
downloadpdfium-d5d48457dabbe71e7f6b0baf2eaea6aa0dc86736.tar.xz
Do not build PNG when codec is disabled
Currently all of the PNG 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 PNG codec code if support for PNG is turned off. BUG=pdfium:1080 Change-Id: I9c5247145fcadbcb1bd2243aa83350304ba421ff Reviewed-on: https://pdfium-review.googlesource.com/32270 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_progressivedecoder.h')
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h61
1 files changed, 38 insertions, 23 deletions
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 9a0136c872..476a7c1b4a 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -14,7 +14,6 @@
#include "core/fxcodec/codec/ccodec_bmpmodule.h"
#include "core/fxcodec/codec/ccodec_gifmodule.h"
#include "core/fxcodec/codec/ccodec_jpegmodule.h"
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
#include "core/fxcodec/fx_codec_def.h"
#include "core/fxcrt/fx_system.h"
#include "core/fxcrt/retain_ptr.h"
@@ -22,6 +21,10 @@
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/fx_dib.h"
+#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
@@ -30,9 +33,14 @@ class CCodec_ModuleMgr;
class CFX_DIBAttribute;
class IFX_SeekableReadStream;
+class CCodec_Dummy {}; // Placeholder to work around C++ syntax issues
+
class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
public CCodec_GifModule::Delegate,
- public CCodec_PngModule::Delegate {
+#ifdef PDF_ENABLE_XFA_PNG
+ public CCodec_PngModule::Delegate,
+#endif // PDF_ENABLE_XFA_PNG
+ public CCodec_Dummy {
public:
enum FXCodec_Format {
FXCodec_Invalid = 0,
@@ -126,6 +134,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
std::vector<uint8_t> m_pWeightTables;
};
+#ifdef PDF_ENABLE_XFA_PNG
// CCodec_PngModule::Delegate
bool PngReadHeader(int width,
int height,
@@ -135,6 +144,7 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
double* gamma) override;
bool PngAskScanlineBuf(int line, uint8_t** pSrcBuf) override;
void PngFillScanlineBufCompleted(int pass, int line) override;
+#endif // PDF_ENABLE_XFA_PNG
// CCodec_GifModule::Delegate
void GifRecordCurrentPosition(uint32_t& cur_pos) override;
@@ -157,24 +167,43 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
private:
bool BmpReadMoreData(CCodec_BmpModule* pBmpModule,
FXCODEC_STATUS& err_status);
+ bool BmpDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
+ FXCODEC_STATUS BmpStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
+ FXCODEC_STATUS BmpContinueDecode();
+
bool GifReadMoreData(CCodec_GifModule* pGifModule,
FXCODEC_STATUS& err_status);
+ bool GifDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
+ FXCODEC_STATUS GifStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
+ FXCODEC_STATUS GifContinueDecode();
+ void GifDoubleLineResampleVert(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ double scale_y,
+ int dest_row);
+
bool JpegReadMoreData(CCodec_JpegModule* pJpegModule,
FXCODEC_STATUS& err_status);
+ bool JpegDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
+ FXCODEC_STATUS JpegStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
+ FXCODEC_STATUS JpegContinueDecode();
+
+#ifdef PDF_ENABLE_XFA_PNG
void PngOneOneMapResampleHorz(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int32_t dest_line,
uint8_t* src_scan,
FXCodec_Format src_format);
- bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
- CFX_DIBAttribute* pAttribute);
- bool BmpDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
- bool JpegDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
bool PngDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
- bool GifDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
+ FXCODEC_STATUS PngStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
+ FXCODEC_STATUS PngContinueDecode();
+#endif // PDF_ENABLE_XFA_PNG
+
#ifdef PDF_ENABLE_XFA_TIFF
bool TiffDetectImageType(CFX_DIBAttribute* pAttribute, uint32_t size);
+ FXCODEC_STATUS TiffContinueDecode();
#endif // PDF_ENABLE_XFA_TIFF
+ bool DetectImageType(FXCODEC_IMAGE_TYPE imageType,
+ CFX_DIBAttribute* pAttribute);
+
void GetDownScale(int& down_scale);
void GetTransMethod(FXDIB_Format dest_format, FXCodec_Format src_format);
@@ -192,28 +221,14 @@ class CCodec_ProgressiveDecoder : public CCodec_BmpModule::Delegate,
void ResampleVertBT(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
double scale_y,
int dest_row);
- void GifDoubleLineResampleVert(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
- double scale_y,
- int dest_row);
-
- FXCODEC_STATUS JpegStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
- FXCODEC_STATUS PngStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
- FXCODEC_STATUS GifStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
- FXCODEC_STATUS BmpStartDecode(const RetainPtr<CFX_DIBitmap>& pDIBitmap);
-
- FXCODEC_STATUS JpegContinueDecode();
- FXCODEC_STATUS PngContinueDecode();
- FXCODEC_STATUS GifContinueDecode();
- FXCODEC_STATUS BmpContinueDecode();
-#ifdef PDF_ENABLE_XFA_TIFF
- FXCODEC_STATUS TiffContinueDecode();
-#endif // PDF_ENABLE_XFA_TIFF
RetainPtr<IFX_SeekableReadStream> m_pFile;
RetainPtr<CFX_DIBitmap> m_pDeviceBitmap;
UnownedPtr<CCodec_ModuleMgr> m_pCodecMgr;
std::unique_ptr<CCodec_JpegModule::Context> m_pJpegContext;
+#ifdef PDF_ENABLE_XFA_PNG
std::unique_ptr<CCodec_PngModule::Context> m_pPngContext;
+#endif // PDF_ENABLE_XFA_PNG
std::unique_ptr<CCodec_GifModule::Context> m_pGifContext;
std::unique_ptr<CCodec_BmpModule::Context> m_pBmpContext;
#ifdef PDF_ENABLE_XFA_TIFF