summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.cpp (renamed from core/fxcodec/codec/fx_codec_progress.cpp)50
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h60
2 files changed, 37 insertions, 73 deletions
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index c5fb1e3a13..ce0ef9767c 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -250,43 +250,8 @@ void CCodec_ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len,
}
CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
- CCodec_ModuleMgr* pCodecMgr) {
- m_pFile = nullptr;
- m_pCodecMgr = nullptr;
- m_pSrcBuf = nullptr;
- m_pDecodeBuf = nullptr;
- m_pDeviceBitmap = nullptr;
- m_pSrcPalette = nullptr;
- m_pCodecMgr = pCodecMgr;
- m_offSet = 0;
- m_SrcSize = 0;
- m_ScanlineSize = 0;
- m_SrcWidth = 0;
- m_SrcHeight = 0;
- m_SrcComponents = 0;
- m_SrcBPC = 0;
- m_SrcPassNumber = 0;
- m_clipBox = FX_RECT(0, 0, 0, 0);
- m_imagType = FXCODEC_IMAGE_UNKNOWN;
- m_status = FXCODEC_STATUS_DECODE_FINISH;
- m_TransMethod = -1;
- m_SrcRow = 0;
- m_SrcFormat = FXCodec_Invalid;
- 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_InvalidateGifBuffer = true;
-#endif // PDF_ENABLE_XFA_GIF
-#ifdef PDF_ENABLE_XFA_BMP
- m_BmpIsTopBottom = false;
-#endif // PDF_ENABLE_XFA_BMP
-}
+ CCodec_ModuleMgr* pCodecMgr)
+ : m_pCodecMgr(pCodecMgr) {}
CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {
FX_Free(m_pSrcBuf);
@@ -425,7 +390,6 @@ bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t** pSrcBuf) {
return true;
}
-
void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass,
int line) {
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
@@ -1789,7 +1753,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
m_SrcPassNumber = 0;
if (imageType != FXCODEC_IMAGE_UNKNOWN &&
DetectImageType(imageType, pAttribute)) {
- m_imagType = imageType;
+ m_imageType = imageType;
m_status = FXCODEC_STATUS_FRAME_READY;
return m_status;
}
@@ -1801,7 +1765,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
for (int type = FXCODEC_IMAGE_UNKNOWN + 1; type < FXCODEC_IMAGE_MAX; type++) {
if (DetectImageType(static_cast<FXCODEC_IMAGE_TYPE>(type), pAttribute)) {
- m_imagType = static_cast<FXCODEC_IMAGE_TYPE>(type);
+ m_imageType = static_cast<FXCODEC_IMAGE_TYPE>(type);
m_status = FXCODEC_STATUS_FRAME_READY;
return m_status;
}
@@ -2312,7 +2276,7 @@ std::pair<FXCODEC_STATUS, size_t> CCodec_ProgressiveDecoder::GetFrames() {
return {FXCODEC_STATUS_ERROR, 0};
}
- switch (m_imagType) {
+ switch (m_imageType) {
#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP:
#endif // PDF_ENABLE_XFA_BMP
@@ -2413,7 +2377,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
if (m_clipBox.IsEmpty()) {
return FXCODEC_STATUS_ERR_PARAMS;
}
- switch (m_imagType) {
+ switch (m_imageType) {
#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP:
return BmpStartDecode(pDIBitmap);
@@ -2442,7 +2406,7 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
if (m_status != FXCODEC_STATUS_DECODE_TOBECONTINUE)
return FXCODEC_STATUS_ERROR;
- switch (m_imagType) {
+ switch (m_imageType) {
case FXCODEC_IMAGE_JPG:
return JpegContinueDecode();
#ifdef PDF_ENABLE_XFA_BMP
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 979de6ed25..b5890e9d9c 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -73,7 +73,7 @@ class CCodec_ProgressiveDecoder :
CFX_DIBAttribute* pAttribute,
bool bSkipImageTypeCheck);
- FXCODEC_IMAGE_TYPE GetType() const { return m_imagType; }
+ FXCODEC_IMAGE_TYPE GetType() const { return m_imageType; }
int32_t GetWidth() const { return m_SrcWidth; }
int32_t GetHeight() const { return m_SrcHeight; }
int32_t GetNumComponents() const { return m_SrcComponents; }
@@ -241,6 +241,8 @@ class CCodec_ProgressiveDecoder :
double scale_y,
int dest_row);
+ FXCODEC_STATUS m_status = FXCODEC_STATUS_DECODE_FINISH;
+ FXCODEC_IMAGE_TYPE m_imageType = FXCODEC_IMAGE_UNKNOWN;
RetainPtr<IFX_SeekableReadStream> m_pFile;
RetainPtr<CFX_DIBitmap> m_pDeviceBitmap;
UnownedPtr<CCodec_ModuleMgr> m_pCodecMgr;
@@ -257,44 +259,42 @@ class CCodec_ProgressiveDecoder :
#ifdef PDF_ENABLE_XFA_TIFF
std::unique_ptr<CCodec_TiffModule::Context> m_pTiffContext;
#endif // PDF_ENABLE_XFA_TIFF
- FXCODEC_IMAGE_TYPE m_imagType;
- uint32_t m_offSet;
- uint8_t* m_pSrcBuf;
- uint32_t m_SrcSize;
- uint8_t* m_pDecodeBuf;
- int m_ScanlineSize;
+ uint32_t m_offSet = 0;
+ uint8_t* m_pSrcBuf = nullptr;
+ uint32_t m_SrcSize = 0;
+ uint8_t* m_pDecodeBuf = nullptr;
+ int m_ScanlineSize = 0;
CFXCODEC_WeightTable m_WeightHorz;
CFXCODEC_VertTable m_WeightVert;
CFXCODEC_HorzTable m_WeightHorzOO;
- int m_SrcWidth;
- int m_SrcHeight;
- int m_SrcComponents;
- int m_SrcBPC;
+ int m_SrcWidth = 0;
+ int m_SrcHeight = 0;
+ int m_SrcComponents = 0;
+ int m_SrcBPC = 0;
FX_RECT m_clipBox;
- int m_startX;
- int m_startY;
- int m_sizeX;
- int m_sizeY;
- int m_TransMethod;
- FX_ARGB* m_pSrcPalette;
- int m_SrcPaletteNumber;
- int m_SrcRow;
- FXCodec_Format m_SrcFormat;
- int m_SrcPassNumber;
- size_t m_FrameNumber;
- size_t m_FrameCur;
+ int m_startX = 0;
+ int m_startY = 0;
+ int m_sizeX = 0;
+ int m_sizeY = 0;
+ int m_TransMethod = -1;
+ FX_ARGB* m_pSrcPalette = nullptr;
+ int m_SrcPaletteNumber = 0;
+ int m_SrcRow = 0;
+ FXCodec_Format m_SrcFormat = FXCodec_Invalid;
+ int m_SrcPassNumber = 0;
+ size_t m_FrameNumber = 0;
+ size_t m_FrameCur = 0;
#ifdef PDF_ENABLE_XFA_GIF
- int m_GifBgIndex;
- CFX_GifPalette* m_pGifPalette;
- int32_t m_GifPltNumber;
- int m_GifTransIndex;
+ int m_GifBgIndex = 0;
+ CFX_GifPalette* m_pGifPalette = nullptr;
+ int32_t m_GifPltNumber = 0;
+ int m_GifTransIndex = -1;
FX_RECT m_GifFrameRect;
- bool m_InvalidateGifBuffer;
+ bool m_InvalidateGifBuffer = true;
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_BMP
- bool m_BmpIsTopBottom;
+ bool m_BmpIsTopBottom = false;
#endif // PDF_ENABLE_XFA_BMP
- FXCODEC_STATUS m_status;
};
#endif // CORE_FXCODEC_CODEC_CCODEC_PROGRESSIVEDECODER_H_