Rename CCodec_ProgressiveDecoder to fxcodec::ProgressiveDecoder.
BUG=pdfium:1311
Change-Id: Ibd849f7f51ad1e36cb9afe3b51e3442de72acf6b
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55835
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/BUILD.gn b/core/fxcodec/BUILD.gn
index 0ebadc5..ca3baa2 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -83,8 +83,8 @@
if (pdf_enable_xfa) {
sources += [
- "codec/ccodec_progressivedecoder.cpp",
- "codec/ccodec_progressivedecoder.h",
+ "codec/progressivedecoder.cpp",
+ "codec/progressivedecoder.h",
]
if (pdf_enable_xfa_bmp) {
sources += [
@@ -143,7 +143,7 @@
pdfium_root_dir = "../../"
if (pdf_enable_xfa) {
- sources += [ "codec/ccodec_progressivedecoder_unittest.cpp" ]
+ sources += [ "codec/progressivedecoder_unittest.cpp" ]
deps += [ "../fxge" ]
if (pdf_enable_xfa_gif) {
sources += [
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/progressivedecoder.cpp
similarity index 93%
rename from core/fxcodec/codec/ccodec_progressivedecoder.cpp
rename to core/fxcodec/codec/progressivedecoder.cpp
index 433e88a..2987ea3 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/progressivedecoder.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
+#include "core/fxcodec/codec/progressivedecoder.h"
#include <algorithm>
#include <memory>
@@ -25,6 +25,8 @@
#define FXCODEC_BLOCK_SIZE 4096
+namespace fxcodec {
+
namespace {
#ifdef PDF_ENABLE_XFA_PNG
@@ -50,16 +52,16 @@
} // namespace
-CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::CFXCODEC_WeightTable() {}
+ProgressiveDecoder::CFXCODEC_WeightTable::CFXCODEC_WeightTable() = default;
-CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::~CFXCODEC_WeightTable() {}
+ProgressiveDecoder::CFXCODEC_WeightTable::~CFXCODEC_WeightTable() = default;
-void CCodec_ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
- int dest_min,
- int dest_max,
- int src_len,
- int src_min,
- int src_max) {
+void ProgressiveDecoder::CFXCODEC_WeightTable::Calc(int dest_len,
+ int dest_min,
+ int dest_max,
+ int src_len,
+ int src_min,
+ int src_max) {
double scale, base;
scale = (float)src_len / (float)dest_len;
if (dest_len < 0) {
@@ -142,12 +144,11 @@
}
}
-CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::CFXCODEC_HorzTable() {}
+ProgressiveDecoder::CFXCODEC_HorzTable::CFXCODEC_HorzTable() = default;
-CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::~CFXCODEC_HorzTable() {}
+ProgressiveDecoder::CFXCODEC_HorzTable::~CFXCODEC_HorzTable() = default;
-void CCodec_ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len,
- int src_len) {
+void ProgressiveDecoder::CFXCODEC_HorzTable::Calc(int dest_len, int src_len) {
double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
@@ -196,12 +197,11 @@
}
}
-CCodec_ProgressiveDecoder::CFXCODEC_VertTable::CFXCODEC_VertTable() {}
+ProgressiveDecoder::CFXCODEC_VertTable::CFXCODEC_VertTable() = default;
-CCodec_ProgressiveDecoder::CFXCODEC_VertTable::~CFXCODEC_VertTable() {}
+ProgressiveDecoder::CFXCODEC_VertTable::~CFXCODEC_VertTable() = default;
-void CCodec_ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len,
- int src_len) {
+void ProgressiveDecoder::CFXCODEC_VertTable::Calc(int dest_len, int src_len) {
double scale = (double)dest_len / (double)src_len;
m_ItemSize = sizeof(int) * 4;
int size = dest_len * m_ItemSize + 4;
@@ -253,19 +253,18 @@
}
}
-CCodec_ProgressiveDecoder::CCodec_ProgressiveDecoder(
- CCodec_ModuleMgr* pCodecMgr)
+ProgressiveDecoder::ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr)
: m_pCodecMgr(pCodecMgr) {}
-CCodec_ProgressiveDecoder::~CCodec_ProgressiveDecoder() {}
+ProgressiveDecoder::~ProgressiveDecoder() = default;
#ifdef PDF_ENABLE_XFA_PNG
-bool CCodec_ProgressiveDecoder::PngReadHeader(int width,
- int height,
- int bpc,
- int pass,
- int* color_type,
- double* gamma) {
+bool ProgressiveDecoder::PngReadHeader(int width,
+ int height,
+ int bpc,
+ int pass,
+ int* color_type,
+ double* gamma) {
if (!m_pDeviceBitmap) {
m_SrcWidth = width;
m_SrcHeight = height;
@@ -317,7 +316,7 @@
return true;
}
-bool CCodec_ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t** pSrcBuf) {
+bool ProgressiveDecoder::PngAskScanlineBuf(int line, uint8_t** pSrcBuf) {
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
if (!pDIBitmap) {
NOTREACHED();
@@ -390,8 +389,7 @@
return true;
}
-void CCodec_ProgressiveDecoder::PngFillScanlineBufCompleted(int pass,
- int line) {
+void ProgressiveDecoder::PngFillScanlineBufCompleted(int pass, int line) {
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
int src_top = m_clipBox.top;
@@ -420,22 +418,21 @@
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_GIF
-void CCodec_ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) {
+void ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) {
uint32_t remain_size =
m_pCodecMgr->GetGifModule()->GetAvailInput(m_pGifContext.get());
cur_pos = m_offSet - remain_size;
}
-bool CCodec_ProgressiveDecoder::GifInputRecordPositionBuf(
- uint32_t rcd_pos,
- const FX_RECT& img_rc,
- int32_t pal_num,
- CFX_GifPalette* pal_ptr,
- int32_t delay_time,
- bool user_input,
- int32_t trans_index,
- int32_t disposal_method,
- bool interlace) {
+bool ProgressiveDecoder::GifInputRecordPositionBuf(uint32_t rcd_pos,
+ const FX_RECT& img_rc,
+ int32_t pal_num,
+ CFX_GifPalette* pal_ptr,
+ int32_t delay_time,
+ bool user_input,
+ int32_t trans_index,
+ int32_t disposal_method,
+ bool interlace) {
m_offSet = rcd_pos;
m_InvalidateGifBuffer = true;
@@ -516,8 +513,7 @@
return true;
}
-void CCodec_ProgressiveDecoder::GifReadScanline(int32_t row_num,
- uint8_t* row_buf) {
+void ProgressiveDecoder::GifReadScanline(int32_t row_num, uint8_t* row_buf) {
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
int32_t img_width = m_GifFrameRect.Width();
@@ -580,16 +576,15 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_BMP
-bool CCodec_ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) {
+bool ProgressiveDecoder::BmpInputImagePositionBuf(uint32_t rcd_pos) {
m_offSet = rcd_pos;
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERROR;
return BmpReadMoreData(m_pCodecMgr->GetBmpModule(), m_pBmpContext.get(),
error_status);
}
-void CCodec_ProgressiveDecoder::BmpReadScanline(
- uint32_t row_num,
- const std::vector<uint8_t>& row_buf) {
+void ProgressiveDecoder::BmpReadScanline(uint32_t row_num,
+ const std::vector<uint8_t>& row_buf) {
RetainPtr<CFX_DIBitmap> pDIBitmap = m_pDeviceBitmap;
ASSERT(pDIBitmap);
std::copy(row_buf.begin(), row_buf.begin() + m_ScanlineSize,
@@ -621,7 +616,7 @@
ResampleVertBT(pDIBitmap, scale_y, dest_row);
}
-void CCodec_ProgressiveDecoder::ResampleVertBT(
+void ProgressiveDecoder::ResampleVertBT(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
double scale_y,
int dest_row) {
@@ -712,7 +707,7 @@
}
}
-bool CCodec_ProgressiveDecoder::BmpDetectImageTypeInBuffer(
+bool ProgressiveDecoder::BmpDetectImageTypeInBuffer(
CFX_DIBAttribute* pAttribute) {
BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
@@ -792,14 +787,13 @@
return true;
}
-bool CCodec_ProgressiveDecoder::BmpReadMoreData(
- BmpModule* pBmpModule,
- CodecModuleIface::Context* pContext,
- FXCODEC_STATUS& err_status) {
+bool ProgressiveDecoder::BmpReadMoreData(BmpModule* pBmpModule,
+ CodecModuleIface::Context* pContext,
+ FXCODEC_STATUS& err_status) {
return ReadMoreData(pBmpModule, pContext, false, err_status);
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpStartDecode(
+FXCODEC_STATUS ProgressiveDecoder::BmpStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
@@ -818,7 +812,7 @@
return m_status;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::BmpContinueDecode() {
BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
if (!pBmpModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -851,8 +845,8 @@
#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
-bool CCodec_ProgressiveDecoder::GifReadMoreData(GifModule* pGifModule,
- FXCODEC_STATUS& err_status) {
+bool ProgressiveDecoder::GifReadMoreData(GifModule* pGifModule,
+ FXCODEC_STATUS& err_status) {
if (!ReadMoreData(pGifModule, m_pGifContext.get(), m_InvalidateGifBuffer,
err_status)) {
return false;
@@ -861,7 +855,7 @@
return true;
}
-bool CCodec_ProgressiveDecoder::GifDetectImageTypeInBuffer() {
+bool ProgressiveDecoder::GifDetectImageTypeInBuffer() {
GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -894,7 +888,7 @@
return false;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::GifStartDecode(
+FXCODEC_STATUS ProgressiveDecoder::GifStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
@@ -915,7 +909,7 @@
return m_status;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::GifContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::GifContinueDecode() {
GifModule* pGifModule = m_pCodecMgr->GetGifModule();
if (!pGifModule) {
m_pDeviceBitmap = nullptr;
@@ -950,7 +944,7 @@
return m_status;
}
-void CCodec_ProgressiveDecoder::GifDoubleLineResampleVert(
+void ProgressiveDecoder::GifDoubleLineResampleVert(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
double scale_y,
int dest_row) {
@@ -1038,12 +1032,12 @@
}
#endif // PDF_ENABLE_XFA_GIF
-bool CCodec_ProgressiveDecoder::JpegReadMoreData(JpegModule* pJpegModule,
- FXCODEC_STATUS& err_status) {
+bool ProgressiveDecoder::JpegReadMoreData(JpegModule* pJpegModule,
+ FXCODEC_STATUS& err_status) {
return ReadMoreData(pJpegModule, m_pJpegContext.get(), false, err_status);
}
-bool CCodec_ProgressiveDecoder::JpegDetectImageTypeInBuffer(
+bool ProgressiveDecoder::JpegDetectImageTypeInBuffer(
CFX_DIBAttribute* pAttribute) {
JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
m_pJpegContext = pJpegModule->Start();
@@ -1084,7 +1078,7 @@
return false;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::JpegStartDecode(
+FXCODEC_STATUS ProgressiveDecoder::JpegStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
int down_scale = 1;
@@ -1132,7 +1126,7 @@
return m_status;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::JpegContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::JpegContinueDecode() {
JpegModule* pJpegModule = m_pCodecMgr->GetJpegModule();
// Setting jump marker before calling ReadScanLine, since a longjmp to
// the marker indicates a fatal error.
@@ -1172,7 +1166,7 @@
}
#ifdef PDF_ENABLE_XFA_PNG
-void CCodec_ProgressiveDecoder::PngOneOneMapResampleHorz(
+void ProgressiveDecoder::PngOneOneMapResampleHorz(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int32_t dest_line,
uint8_t* src_scan,
@@ -1249,7 +1243,7 @@
}
}
-bool CCodec_ProgressiveDecoder::PngDetectImageTypeInBuffer(
+bool ProgressiveDecoder::PngDetectImageTypeInBuffer(
CFX_DIBAttribute* pAttribute) {
PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
@@ -1288,7 +1282,7 @@
return true;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::PngStartDecode(
+FXCODEC_STATUS ProgressiveDecoder::PngStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
@@ -1336,7 +1330,7 @@
return m_status;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::PngContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::PngContinueDecode() {
PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -1377,7 +1371,7 @@
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_TIFF
-bool CCodec_ProgressiveDecoder::TiffDetectImageTypeFromFile(
+bool ProgressiveDecoder::TiffDetectImageTypeFromFile(
CFX_DIBAttribute* pAttribute) {
TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
@@ -1403,7 +1397,7 @@
return true;
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::TiffContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::TiffContinueDecode() {
TiffModule* pTiffModule = m_pCodecMgr->GetTiffModule();
if (!pTiffModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
@@ -1546,8 +1540,8 @@
}
#endif // PDF_ENABLE_XFA_TIFF
-bool CCodec_ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
- CFX_DIBAttribute* pAttribute) {
+bool ProgressiveDecoder::DetectImageType(FXCODEC_IMAGE_TYPE imageType,
+ CFX_DIBAttribute* pAttribute) {
#ifdef PDF_ENABLE_XFA_TIFF
if (imageType == FXCODEC_IMAGE_TIFF)
return TiffDetectImageTypeFromFile(pAttribute);
@@ -1585,11 +1579,10 @@
return false;
}
-bool CCodec_ProgressiveDecoder::ReadMoreData(
- CodecModuleIface* pModule,
- CodecModuleIface::Context* pContext,
- bool invalidate_buffer,
- FXCODEC_STATUS& err_status) {
+bool ProgressiveDecoder::ReadMoreData(CodecModuleIface* pModule,
+ CodecModuleIface::Context* pContext,
+ bool invalidate_buffer,
+ FXCODEC_STATUS& err_status) {
// Check for EOF.
if (m_offSet >= static_cast<uint32_t>(m_pFile->GetSize()))
return false;
@@ -1634,7 +1627,7 @@
return pModule->Input(pContext, m_pCodecMemory, nullptr);
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::LoadImageInfo(
+FXCODEC_STATUS ProgressiveDecoder::LoadImageInfo(
const RetainPtr<IFX_SeekableReadStream>& pFile,
FXCODEC_IMAGE_TYPE imageType,
CFX_DIBAttribute* pAttribute,
@@ -1687,7 +1680,7 @@
return m_status;
}
-void CCodec_ProgressiveDecoder::SetClipBox(FX_RECT* clip) {
+void ProgressiveDecoder::SetClipBox(FX_RECT* clip) {
if (m_status != FXCODEC_STATUS_FRAME_READY)
return;
@@ -1706,7 +1699,7 @@
m_clipBox = *clip;
}
-void CCodec_ProgressiveDecoder::GetDownScale(int& down_scale) {
+void ProgressiveDecoder::GetDownScale(int& down_scale) {
down_scale = 1;
int ratio_w = m_clipBox.Width() / m_sizeX;
int ratio_h = m_clipBox.Height() / m_sizeY;
@@ -1730,8 +1723,8 @@
}
}
-void CCodec_ProgressiveDecoder::GetTransMethod(FXDIB_Format dest_format,
- FXCodec_Format src_format) {
+void ProgressiveDecoder::GetTransMethod(FXDIB_Format dest_format,
+ FXCodec_Format src_format) {
switch (dest_format) {
case FXDIB_1bppMask:
case FXDIB_1bppRgb: {
@@ -1828,7 +1821,7 @@
}
}
-void CCodec_ProgressiveDecoder::ReSampleScanline(
+void ProgressiveDecoder::ReSampleScanline(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
int dest_line,
uint8_t* src_scan,
@@ -2055,7 +2048,7 @@
}
}
-void CCodec_ProgressiveDecoder::ResampleVert(
+void ProgressiveDecoder::ResampleVert(
const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
double scale_y,
int dest_row) {
@@ -2159,11 +2152,10 @@
}
}
-void CCodec_ProgressiveDecoder::Resample(
- const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
- int32_t src_line,
- uint8_t* src_scan,
- FXCodec_Format src_format) {
+void ProgressiveDecoder::Resample(const RetainPtr<CFX_DIBitmap>& pDeviceBitmap,
+ int32_t src_line,
+ uint8_t* src_scan,
+ FXCodec_Format src_format) {
int src_top = m_clipBox.top;
int dest_top = m_startY;
int src_height = m_clipBox.Height();
@@ -2181,7 +2173,7 @@
}
}
-std::pair<FXCODEC_STATUS, size_t> CCodec_ProgressiveDecoder::GetFrames() {
+std::pair<FXCODEC_STATUS, size_t> ProgressiveDecoder::GetFrames() {
if (!(m_status == FXCODEC_STATUS_FRAME_READY ||
m_status == FXCODEC_STATUS_FRAME_TOBECONTINUE)) {
return {FXCODEC_STATUS_ERROR, 0};
@@ -2235,7 +2227,7 @@
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::StartDecode(
+FXCODEC_STATUS ProgressiveDecoder::StartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap,
int start_x,
int start_y,
@@ -2313,7 +2305,7 @@
}
}
-FXCODEC_STATUS CCodec_ProgressiveDecoder::ContinueDecode() {
+FXCODEC_STATUS ProgressiveDecoder::ContinueDecode() {
if (m_status != FXCODEC_STATUS_DECODE_TOBECONTINUE)
return FXCODEC_STATUS_ERROR;
@@ -2341,7 +2333,9 @@
}
}
-std::unique_ptr<CCodec_ProgressiveDecoder>
+} // namespace fxcodec
+
+std::unique_ptr<ProgressiveDecoder>
CCodec_ModuleMgr::CreateProgressiveDecoder() {
- return pdfium::MakeUnique<CCodec_ProgressiveDecoder>(this);
+ return pdfium::MakeUnique<ProgressiveDecoder>(this);
}
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/progressivedecoder.h
similarity index 95%
rename from core/fxcodec/codec/ccodec_progressivedecoder.h
rename to core/fxcodec/codec/progressivedecoder.h
index 64c9103..149efd3 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/progressivedecoder.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCODEC_CODEC_CCODEC_PROGRESSIVEDECODER_H_
-#define CORE_FXCODEC_CODEC_CCODEC_PROGRESSIVEDECODER_H_
+#ifndef CORE_FXCODEC_CODEC_PROGRESSIVEDECODER_H_
+#define CORE_FXCODEC_CODEC_PROGRESSIVEDECODER_H_
#include <memory>
#include <utility>
@@ -39,9 +39,11 @@
class CFX_DIBitmap;
class IFX_SeekableReadStream;
-class CCodec_Dummy {}; // Placeholder to work around C++ syntax issues
+namespace fxcodec {
-class CCodec_ProgressiveDecoder :
+class Dummy {}; // Placeholder to work around C++ syntax issues
+
+class ProgressiveDecoder :
#ifdef PDF_ENABLE_XFA_BMP
public BmpModule::Delegate,
#endif // PDF_ENABLE_XFA_BMP
@@ -51,7 +53,7 @@
#ifdef PDF_ENABLE_XFA_PNG
public PngModule::Delegate,
#endif // PDF_ENABLE_XFA_PNG
- public CCodec_Dummy {
+ public Dummy {
public:
enum FXCodec_Format {
FXCodec_Invalid = 0,
@@ -65,8 +67,8 @@
FXCodec_Cmyk = 0x120
};
- explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
- virtual ~CCodec_ProgressiveDecoder();
+ explicit ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr);
+ virtual ~ProgressiveDecoder();
FXCODEC_STATUS LoadImageInfo(const RetainPtr<IFX_SeekableReadStream>& pFile,
FXCODEC_IMAGE_TYPE imageType,
@@ -299,4 +301,8 @@
#endif // PDF_ENABLE_XFA_BMP
};
-#endif // CORE_FXCODEC_CODEC_CCODEC_PROGRESSIVEDECODER_H_
+} // namespace fxcodec
+
+using ProgressiveDecoder = fxcodec::ProgressiveDecoder;
+
+#endif // CORE_FXCODEC_CODEC_PROGRESSIVEDECODER_H_
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder_unittest.cpp b/core/fxcodec/codec/progressivedecoder_unittest.cpp
similarity index 99%
rename from core/fxcodec/codec/ccodec_progressivedecoder_unittest.cpp
rename to core/fxcodec/codec/progressivedecoder_unittest.cpp
index ad7c321..6489f3d 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder_unittest.cpp
+++ b/core/fxcodec/codec/progressivedecoder_unittest.cpp
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
+#include "core/fxcodec/codec/progressivedecoder.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/cfx_readonlymemorystream.h"
@@ -15,8 +15,10 @@
#include "core/fxcodec/codec/gifmodule.h"
#endif // PDF_ENABLE_XFA_GIF
+namespace fxcodec {
+
#ifdef PDF_ENABLE_XFA_GIF
-TEST(CCodec_ProgressiveDecoder, BUG_895009) {
+TEST(ProgressiveDecoder, BUG_895009) {
static constexpr uint8_t kInput[] = {
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x62, 0x00, 0x21, 0x1b, 0x27, 0x01,
0x00, 0x2c, 0x3b, 0x00, 0x00, 0x00, 0x20, 0x00, 0x71, 0x00, 0xf8, 0x20,
@@ -372,7 +374,7 @@
CCodec_ModuleMgr::GetInstance()->SetGifModule(
pdfium::MakeUnique<GifModule>());
{
- std::unique_ptr<CCodec_ProgressiveDecoder> decoder =
+ std::unique_ptr<ProgressiveDecoder> decoder =
CCodec_ModuleMgr::GetInstance()->CreateProgressiveDecoder();
auto source = pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(kInput);
@@ -401,3 +403,5 @@
CCodec_ModuleMgr::Destroy();
}
#endif // PDF_ENABLE_XFA_GIF
+
+} // namespace fxcodec
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index ede8d3a..1e69366 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -35,8 +35,6 @@
#endif // PDF_ENABLE_XFA
#ifdef PDF_ENABLE_XFA
-class CCodec_ProgressiveDecoder;
-
class CFX_DIBAttribute {
public:
CFX_DIBAttribute();
@@ -52,6 +50,7 @@
namespace fxcodec {
class Jbig2Module;
class JpegModule;
+class ProgressiveDecoder;
}
class CCodec_ModuleMgr {
@@ -65,7 +64,7 @@
fxcodec::Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); }
#ifdef PDF_ENABLE_XFA
- std::unique_ptr<CCodec_ProgressiveDecoder> CreateProgressiveDecoder();
+ std::unique_ptr<fxcodec::ProgressiveDecoder> CreateProgressiveDecoder();
#ifdef PDF_ENABLE_XFA_BMP
BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
diff --git a/testing/fuzzers/xfa_codec_fuzzer.h b/testing/fuzzers/xfa_codec_fuzzer.h
index 22f1e4d..d237ecd 100644
--- a/testing/fuzzers/xfa_codec_fuzzer.h
+++ b/testing/fuzzers/xfa_codec_fuzzer.h
@@ -7,7 +7,7 @@
#include <memory>
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
+#include "core/fxcodec/codec/progressivedecoder.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/cfx_readonlymemorystream.h"
#include "core/fxge/dib/cfx_dibitmap.h"
@@ -22,7 +22,7 @@
public:
static int Fuzz(const uint8_t* data, size_t size, FXCODEC_IMAGE_TYPE type) {
auto* mgr = CCodec_ModuleMgr::GetInstance();
- std::unique_ptr<CCodec_ProgressiveDecoder> decoder =
+ std::unique_ptr<ProgressiveDecoder> decoder =
mgr->CreateProgressiveDecoder();
auto source = pdfium::MakeRetain<CFX_ReadOnlyMemoryStream>(
pdfium::make_span(data, size));
diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp
index dfaf581..427dd2c 100644
--- a/xfa/fxfa/cxfa_ffwidget.cpp
+++ b/xfa/fxfa/cxfa_ffwidget.cpp
@@ -12,7 +12,7 @@
#include <utility>
#include <vector>
-#include "core/fxcodec/codec/ccodec_progressivedecoder.h"
+#include "core/fxcodec/codec/progressivedecoder.h"
#include "core/fxcodec/fx_codec.h"
#include "core/fxcrt/maybe_owned.h"
#include "core/fxge/cfx_pathdata.h"
@@ -155,7 +155,7 @@
int32_t& iImageXDpi,
int32_t& iImageYDpi) {
auto* pCodecMgr = CCodec_ModuleMgr::GetInstance();
- std::unique_ptr<CCodec_ProgressiveDecoder> pProgressiveDecoder =
+ std::unique_ptr<ProgressiveDecoder> pProgressiveDecoder =
pCodecMgr->CreateProgressiveDecoder();
CFX_DIBAttribute dibAttr;