summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_progressivedecoder.h
diff options
context:
space:
mode:
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