summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fxcodec/codec/ccodec_progressivedecoder.h2
-rw-r--r--core/fxcodec/codec/fx_codec.cpp17
-rw-r--r--core/fxcodec/codec/fx_codec_progress.cpp8
-rw-r--r--core/fxcodec/fx_codec.h18
-rw-r--r--core/fxcodec/fx_codec_def.h2
-rw-r--r--xfa/fxfa/cxfa_ffwidget.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp6
7 files changed, 20 insertions, 35 deletions
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 4eeb59d559..979de6ed25 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -244,13 +244,13 @@ class CCodec_ProgressiveDecoder :
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_BMP
std::unique_ptr<CCodec_BmpModule::Context> m_pBmpContext;
#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
std::unique_ptr<CCodec_GifModule::Context> m_pGifContext;
#endif // PDF_ENABLE_XFA_GIF
- 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
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index d81e8f756c..54245a5b99 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -1509,22 +1509,7 @@ bool CCodec_BasicModule::A85Encode(const uint8_t* src_buf,
}
#ifdef PDF_ENABLE_XFA
-CFX_DIBAttribute::CFX_DIBAttribute()
- :
-#ifdef PDF_ENABLE_XFA_BMP
- m_nBmpCompressType(0),
-#endif // PDF_ENABLE_BMP
-#ifdef PDF_ENABLE_XFA_GIF
- m_nGifLeft(0),
- m_nGifTop(0),
- m_pGifLocalPalette(nullptr),
- m_nGifLocalPalNum(0),
-#endif // PDF_ENABLE_XFA_GIF
- m_nXDPI(-1),
- m_nYDPI(-1),
- m_fAspectRatio(-1.0f),
- m_wDPIUnit(0) {
-}
+CFX_DIBAttribute::CFX_DIBAttribute() {}
CFX_DIBAttribute::~CFX_DIBAttribute() {
for (const auto& pair : m_Exif)
diff --git a/core/fxcodec/codec/fx_codec_progress.cpp b/core/fxcodec/codec/fx_codec_progress.cpp
index e45dff6682..6b91e864ab 100644
--- a/core/fxcodec/codec/fx_codec_progress.cpp
+++ b/core/fxcodec/codec/fx_codec_progress.cpp
@@ -1737,6 +1737,8 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
memset(m_pSrcBuf, 0, size);
m_SrcSize = size;
switch (imageType) {
+ case FXCODEC_IMAGE_JPG:
+ return JpegDetectImageType(pAttribute, size);
#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP:
return BmpDetectImageType(pAttribute, size);
@@ -1745,8 +1747,6 @@ bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
case FXCODEC_IMAGE_GIF:
return GifDetectImageType(pAttribute, size);
#endif // PDF_ENABLE_XFA_GIF
- case FXCODEC_IMAGE_JPG:
- return JpegDetectImageType(pAttribute, size);
#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG:
return PngDetectImageType(pAttribute, size);
@@ -2444,6 +2444,8 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
return FXCODEC_STATUS_ERROR;
switch (m_imagType) {
+ case FXCODEC_IMAGE_JPG:
+ return JpegContinueDecode();
#ifdef PDF_ENABLE_XFA_BMP
case FXCODEC_IMAGE_BMP:
return BmpContinueDecode();
@@ -2452,8 +2454,6 @@ FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
case FXCODEC_IMAGE_GIF:
return GifContinueDecode();
#endif // PDF_ENABLE_XFA_GIF
- case FXCODEC_IMAGE_JPG:
- return JpegContinueDecode();
#ifdef PDF_ENABLE_XFA_PNG
case FXCODEC_IMAGE_PNG:
return PngContinueDecode();
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 91d9f2fb32..458358085a 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -57,19 +57,19 @@ class CFX_DIBAttribute {
~CFX_DIBAttribute();
#ifdef PDF_ENABLE_XFA_BMP
- int32_t m_nBmpCompressType;
+ int32_t m_nBmpCompressType = 0;
#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
- int32_t m_nGifLeft;
- int32_t m_nGifTop;
- uint32_t* m_pGifLocalPalette;
- uint32_t m_nGifLocalPalNum;
+ int32_t m_nGifLeft = 0;
+ int32_t m_nGifTop = 0;
+ uint32_t* m_pGifLocalPalette = nullptr;
+ uint32_t m_nGifLocalPalNum = 0;
#endif // PDF_ENABLE_XFA_GIF
- int32_t m_nXDPI;
- int32_t m_nYDPI;
- float m_fAspectRatio;
- uint16_t m_wDPIUnit;
+ int32_t m_nXDPI = -1;
+ int32_t m_nYDPI = -1;
+ float m_fAspectRatio = -1.0f;
+ uint16_t m_wDPIUnit = 0;
std::map<uint32_t, void*> m_Exif;
};
#endif // PDF_ENABLE_XFA
diff --git a/core/fxcodec/fx_codec_def.h b/core/fxcodec/fx_codec_def.h
index 154fe967ee..2d6b5ed937 100644
--- a/core/fxcodec/fx_codec_def.h
+++ b/core/fxcodec/fx_codec_def.h
@@ -26,10 +26,10 @@ enum FXCODEC_STATUS {
#ifdef PDF_ENABLE_XFA
enum FXCODEC_IMAGE_TYPE {
FXCODEC_IMAGE_UNKNOWN = 0,
+ FXCODEC_IMAGE_JPG,
#ifdef PDF_ENABLE_XFA_BMP
FXCODEC_IMAGE_BMP,
#endif // PDF_ENABLE_XFA_BMP
- FXCODEC_IMAGE_JPG,
#ifdef PDF_ENABLE_XFA_PNG
FXCODEC_IMAGE_PNG,
#endif // PDF_ENABLE_XFA_PNG
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index c9bb072cb9..edb42fdd86 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -40,10 +40,10 @@ FXDIB_Format XFA_GetDIBFormat(FXCODEC_IMAGE_TYPE type,
int32_t iBitsPerComponent) {
FXDIB_Format dibFormat = FXDIB_Argb;
switch (type) {
+ case FXCODEC_IMAGE_JPG:
#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:
#endif // PDF_ENABLE_XFA_TIFF
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index af3ad63f72..a51b74ca63 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -164,6 +164,9 @@ FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) {
WideString wsContentType(wsType);
wsContentType.MakeLower();
+ if (wsContentType == L"image/jpg")
+ return FXCODEC_IMAGE_JPG;
+
#ifdef PDF_ENABLE_XFA_BMP
if (wsContentType == L"image/bmp")
return FXCODEC_IMAGE_BMP;
@@ -174,9 +177,6 @@ FXCODEC_IMAGE_TYPE XFA_GetImageType(const WideString& wsType) {
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;