Rename GifModule to GifDecoder.
Change-Id: I53b929d5d9ddb2d60d9f48d7c2ca6ee2264f0fbd
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69935
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/core/fxcodec/BUILD.gn b/core/fxcodec/BUILD.gn
index bc478ae..136d77c 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -107,10 +107,10 @@
"gif/cfx_gifcontext.h",
"gif/cfx_lzwdecompressor.cpp",
"gif/cfx_lzwdecompressor.h",
+ "gif/gif_decoder.cpp",
+ "gif/gif_decoder.h",
"gif/gif_progressive_decoder.cpp",
"gif/gif_progressive_decoder.h",
- "gif/gifmodule.cpp",
- "gif/gifmodule.h",
]
}
if (pdf_enable_xfa_png) {
diff --git a/core/fxcodec/gif/cfx_gifcontext.cpp b/core/fxcodec/gif/cfx_gifcontext.cpp
index c0eb988..c946747 100644
--- a/core/fxcodec/gif/cfx_gifcontext.cpp
+++ b/core/fxcodec/gif/cfx_gifcontext.cpp
@@ -21,7 +21,7 @@
} // namespace
-CFX_GifContext::CFX_GifContext(GifModule::Delegate* delegate)
+CFX_GifContext::CFX_GifContext(GifDecoder::Delegate* delegate)
: delegate_(delegate) {}
CFX_GifContext::~CFX_GifContext() = default;
diff --git a/core/fxcodec/gif/cfx_gifcontext.h b/core/fxcodec/gif/cfx_gifcontext.h
index edc3594..c6c9925 100644
--- a/core/fxcodec/gif/cfx_gifcontext.h
+++ b/core/fxcodec/gif/cfx_gifcontext.h
@@ -12,7 +12,7 @@
#include "core/fxcodec/gif/cfx_gif.h"
#include "core/fxcodec/gif/cfx_lzwdecompressor.h"
-#include "core/fxcodec/gif/gifmodule.h"
+#include "core/fxcodec/gif/gif_decoder.h"
#include "core/fxcrt/unowned_ptr.h"
class CFX_CodecMemory;
@@ -21,7 +21,7 @@
class CFX_GifContext : public ProgressiveDecoderIface::Context {
public:
- explicit CFX_GifContext(GifModule::Delegate* delegate);
+ explicit CFX_GifContext(GifDecoder::Delegate* delegate);
~CFX_GifContext() override;
void RecordCurrentPosition(uint32_t* cur_pos);
@@ -45,7 +45,7 @@
uint32_t GetAvailInput() const;
size_t GetFrameNum() const { return images_.size(); }
- UnownedPtr<GifModule::Delegate> const delegate_;
+ UnownedPtr<GifDecoder::Delegate> const delegate_;
std::vector<CFX_GifPalette> global_palette_;
uint8_t global_pal_exp_ = 0;
uint32_t img_row_offset_ = 0;
diff --git a/core/fxcodec/gif/gifmodule.cpp b/core/fxcodec/gif/gif_decoder.cpp
similarity index 79%
rename from core/fxcodec/gif/gifmodule.cpp
rename to core/fxcodec/gif/gif_decoder.cpp
index dc25022..00831ca 100644
--- a/core/fxcodec/gif/gifmodule.cpp
+++ b/core/fxcodec/gif/gif_decoder.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcodec/gif/gifmodule.h"
+#include "core/fxcodec/gif/gif_decoder.h"
#include "core/fxcodec/cfx_codec_memory.h"
#include "core/fxcodec/fx_codec.h"
@@ -15,13 +15,13 @@
namespace fxcodec {
// static
-std::unique_ptr<ProgressiveDecoderIface::Context> GifModule::StartDecode(
+std::unique_ptr<ProgressiveDecoderIface::Context> GifDecoder::StartDecode(
Delegate* pDelegate) {
return pdfium::MakeUnique<CFX_GifContext>(pDelegate);
}
// static
-CFX_GifDecodeStatus GifModule::ReadHeader(
+CFX_GifDecodeStatus GifDecoder::ReadHeader(
ProgressiveDecoderIface::Context* pContext,
int* width,
int* height,
@@ -43,7 +43,7 @@
}
// static
-std::pair<CFX_GifDecodeStatus, size_t> GifModule::LoadFrameInfo(
+std::pair<CFX_GifDecodeStatus, size_t> GifDecoder::LoadFrameInfo(
ProgressiveDecoderIface::Context* pContext) {
auto* context = static_cast<CFX_GifContext*>(pContext);
CFX_GifDecodeStatus ret = context->GetFrame();
@@ -53,22 +53,22 @@
}
// static
-CFX_GifDecodeStatus GifModule::LoadFrame(
+CFX_GifDecodeStatus GifDecoder::LoadFrame(
ProgressiveDecoderIface::Context* pContext,
size_t frame_num) {
return static_cast<CFX_GifContext*>(pContext)->LoadFrame(frame_num);
}
// static
-FX_FILESIZE GifModule::GetAvailInput(
+FX_FILESIZE GifDecoder::GetAvailInput(
ProgressiveDecoderIface::Context* pContext) {
return static_cast<CFX_GifContext*>(pContext)->GetAvailInput();
}
// static
-bool GifModule::Input(ProgressiveDecoderIface::Context* pContext,
- RetainPtr<CFX_CodecMemory> codec_memory,
- CFX_DIBAttribute*) {
+bool GifDecoder::Input(ProgressiveDecoderIface::Context* pContext,
+ RetainPtr<CFX_CodecMemory> codec_memory,
+ CFX_DIBAttribute*) {
auto* ctx = static_cast<CFX_GifContext*>(pContext);
ctx->SetInputBuffer(std::move(codec_memory));
return true;
diff --git a/core/fxcodec/gif/gifmodule.h b/core/fxcodec/gif/gif_decoder.h
similarity index 87%
rename from core/fxcodec/gif/gifmodule.h
rename to core/fxcodec/gif/gif_decoder.h
index fd8c446..2aaa601 100644
--- a/core/fxcodec/gif/gifmodule.h
+++ b/core/fxcodec/gif/gif_decoder.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCODEC_GIF_GIFMODULE_H_
-#define CORE_FXCODEC_GIF_GIFMODULE_H_
+#ifndef CORE_FXCODEC_GIF_GIF_DECODER_H_
+#define CORE_FXCODEC_GIF_GIF_DECODER_H_
#include <memory>
#include <utility>
@@ -22,7 +22,7 @@
class CFX_DIBAttribute;
-class GifModule {
+class GifDecoder {
public:
class Delegate {
public:
@@ -58,13 +58,13 @@
RetainPtr<CFX_CodecMemory> codec_memory,
CFX_DIBAttribute* pAttribute);
- GifModule() = delete;
- GifModule(const GifModule&) = delete;
- GifModule& operator=(const GifModule&) = delete;
+ GifDecoder() = delete;
+ GifDecoder(const GifDecoder&) = delete;
+ GifDecoder& operator=(const GifDecoder&) = delete;
};
} // namespace fxcodec
-using GifModule = fxcodec::GifModule;
+using GifDecoder = fxcodec::GifDecoder;
-#endif // CORE_FXCODEC_GIF_GIFMODULE_H_
+#endif // CORE_FXCODEC_GIF_GIF_DECODER_H_
diff --git a/core/fxcodec/gif/gif_progressive_decoder.cpp b/core/fxcodec/gif/gif_progressive_decoder.cpp
index 775ef78..ae29051 100644
--- a/core/fxcodec/gif/gif_progressive_decoder.cpp
+++ b/core/fxcodec/gif/gif_progressive_decoder.cpp
@@ -7,7 +7,7 @@
#include "core/fxcodec/gif/gif_progressive_decoder.h"
#include "core/fxcodec/cfx_codec_memory.h"
-#include "core/fxcodec/gif/gifmodule.h"
+#include "core/fxcodec/gif/gif_decoder.h"
namespace fxcodec {
@@ -22,13 +22,13 @@
GifProgressiveDecoder::~GifProgressiveDecoder() = default;
FX_FILESIZE GifProgressiveDecoder::GetAvailInput(Context* context) const {
- return GifModule::GetAvailInput(context);
+ return GifDecoder::GetAvailInput(context);
}
bool GifProgressiveDecoder::Input(Context* context,
RetainPtr<CFX_CodecMemory> codec_memory,
CFX_DIBAttribute* pAttribute) {
- return GifModule::Input(context, codec_memory, pAttribute);
+ return GifDecoder::Input(context, codec_memory, pAttribute);
}
} // namespace fxcodec
diff --git a/core/fxcodec/progressivedecoder.cpp b/core/fxcodec/progressivedecoder.cpp
index 876a93d..96e1466 100644
--- a/core/fxcodec/progressivedecoder.cpp
+++ b/core/fxcodec/progressivedecoder.cpp
@@ -409,7 +409,7 @@
#ifdef PDF_ENABLE_XFA_GIF
void ProgressiveDecoder::GifRecordCurrentPosition(uint32_t& cur_pos) {
- uint32_t remain_size = GifModule::GetAvailInput(m_pGifContext.get());
+ uint32_t remain_size = GifDecoder::GetAvailInput(m_pGifContext.get());
cur_pos = m_offSet - remain_size;
}
@@ -824,12 +824,12 @@
}
bool ProgressiveDecoder::GifDetectImageTypeInBuffer() {
- m_pGifContext = GifModule::StartDecode(this);
- GifModule::Input(m_pGifContext.get(), m_pCodecMemory, nullptr);
+ m_pGifContext = GifDecoder::StartDecode(this);
+ GifDecoder::Input(m_pGifContext.get(), m_pCodecMemory, nullptr);
m_SrcComponents = 1;
CFX_GifDecodeStatus readResult =
- GifModule::ReadHeader(m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight,
- &m_GifPltNumber, &m_pGifPalette, &m_GifBgIndex);
+ GifDecoder::ReadHeader(m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight,
+ &m_GifPltNumber, &m_pGifPalette, &m_GifBgIndex);
while (readResult == CFX_GifDecodeStatus::Unfinished) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_FORMAT;
if (!GifReadMoreData(&error_status)) {
@@ -838,8 +838,8 @@
return false;
}
readResult =
- GifModule::ReadHeader(m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight,
- &m_GifPltNumber, &m_pGifPalette, &m_GifBgIndex);
+ GifDecoder::ReadHeader(m_pGifContext.get(), &m_SrcWidth, &m_SrcHeight,
+ &m_GifPltNumber, &m_pGifPalette, &m_GifBgIndex);
}
if (readResult == CFX_GifDecodeStatus::Success) {
m_SrcBPC = 8;
@@ -866,7 +866,7 @@
FXCODEC_STATUS ProgressiveDecoder::GifContinueDecode() {
CFX_GifDecodeStatus readRes =
- GifModule::LoadFrame(m_pGifContext.get(), m_FrameCur);
+ GifDecoder::LoadFrame(m_pGifContext.get(), m_FrameCur);
while (readRes == CFX_GifDecodeStatus::Unfinished) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_DECODE_FINISH;
if (!GifReadMoreData(&error_status)) {
@@ -875,7 +875,7 @@
m_status = error_status;
return m_status;
}
- readRes = GifModule::LoadFrame(m_pGifContext.get(), m_FrameCur);
+ readRes = GifDecoder::LoadFrame(m_pGifContext.get(), m_FrameCur);
}
if (readRes == CFX_GifDecodeStatus::Success) {
@@ -2116,14 +2116,14 @@
while (true) {
CFX_GifDecodeStatus readResult;
std::tie(readResult, m_FrameNumber) =
- GifModule::LoadFrameInfo(m_pGifContext.get());
+ GifDecoder::LoadFrameInfo(m_pGifContext.get());
while (readResult == CFX_GifDecodeStatus::Unfinished) {
FXCODEC_STATUS error_status = FXCODEC_STATUS_ERR_READ;
if (!GifReadMoreData(&error_status))
return {error_status, 0};
std::tie(readResult, m_FrameNumber) =
- GifModule::LoadFrameInfo(m_pGifContext.get());
+ GifDecoder::LoadFrameInfo(m_pGifContext.get());
}
if (readResult == CFX_GifDecodeStatus::Success) {
m_status = FXCODEC_STATUS_DECODE_READY;
diff --git a/core/fxcodec/progressivedecoder.h b/core/fxcodec/progressivedecoder.h
index a8bbad1..6c76754 100644
--- a/core/fxcodec/progressivedecoder.h
+++ b/core/fxcodec/progressivedecoder.h
@@ -24,7 +24,7 @@
#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
-#include "core/fxcodec/gif/gifmodule.h"
+#include "core/fxcodec/gif/gif_decoder.h"
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
@@ -46,7 +46,7 @@
public BmpModule::Delegate,
#endif // PDF_ENABLE_XFA_BMP
#ifdef PDF_ENABLE_XFA_GIF
- public GifModule::Delegate,
+ public GifDecoder::Delegate,
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
public PngDecoder::Delegate,
@@ -153,7 +153,7 @@
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_GIF
- // GifModule::Delegate
+ // GifDecoder::Delegate
void GifRecordCurrentPosition(uint32_t& cur_pos) override;
bool GifInputRecordPositionBuf(uint32_t rcd_pos,
const FX_RECT& img_rc,
diff --git a/core/fxcodec/progressivedecoder_unittest.cpp b/core/fxcodec/progressivedecoder_unittest.cpp
index 11ef14c..0c4b30a 100644
--- a/core/fxcodec/progressivedecoder_unittest.cpp
+++ b/core/fxcodec/progressivedecoder_unittest.cpp
@@ -12,7 +12,7 @@
#include "third_party/base/span.h"
#ifdef PDF_ENABLE_XFA_GIF
-#include "core/fxcodec/gif/gifmodule.h"
+#include "core/fxcodec/gif/gif_decoder.h"
#endif // PDF_ENABLE_XFA_GIF
namespace fxcodec {