Rename PngModule to PngDecoder.
Change-Id: I11f79d77fedbe5c2f086b642309e3f4ecdf2c7ef
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/69918
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 34023c6..b168112 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -113,8 +113,8 @@
}
if (pdf_enable_xfa_png) {
sources += [
- "png/pngmodule.cpp",
- "png/pngmodule.h",
+ "png/png_decoder.cpp",
+ "png/png_decoder.h",
]
deps += [ "../../third_party:png" ]
}
diff --git a/core/fxcodec/png/pngmodule.cpp b/core/fxcodec/png/png_decoder.cpp
similarity index 92%
rename from core/fxcodec/png/pngmodule.cpp
rename to core/fxcodec/png/png_decoder.cpp
index b254d33..0e4abc4 100644
--- a/core/fxcodec/png/pngmodule.cpp
+++ b/core/fxcodec/png/png_decoder.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcodec/png/pngmodule.h"
+#include "core/fxcodec/png/png_decoder.h"
#include <algorithm>
@@ -25,12 +25,12 @@
class CPngContext final : public ProgressiveDecoderIface::Context {
public:
- explicit CPngContext(PngModule::Delegate* pDelegate);
+ explicit CPngContext(PngDecoder::Delegate* pDelegate);
~CPngContext() override;
png_structp m_pPng = nullptr;
png_infop m_pInfo = nullptr;
- UnownedPtr<PngModule::Delegate> const m_pDelegate;
+ UnownedPtr<PngDecoder::Delegate> const m_pDelegate;
char m_szLastError[PNG_ERROR_SIZE];
};
@@ -172,7 +172,7 @@
} // extern "C"
-CPngContext::CPngContext(PngModule::Delegate* pDelegate)
+CPngContext::CPngContext(PngDecoder::Delegate* pDelegate)
: m_pDelegate(pDelegate) {
memset(m_szLastError, 0, sizeof(m_szLastError));
}
@@ -185,7 +185,7 @@
namespace fxcodec {
// static
-std::unique_ptr<ProgressiveDecoderIface::Context> PngModule::StartDecode(
+std::unique_ptr<ProgressiveDecoderIface::Context> PngDecoder::StartDecode(
Delegate* pDelegate) {
auto p = pdfium::MakeUnique<CPngContext>(pDelegate);
p->m_pPng =
@@ -208,9 +208,9 @@
}
// static
-bool PngModule::ContinueDecode(ProgressiveDecoderIface::Context* pContext,
- RetainPtr<CFX_CodecMemory> codec_memory,
- CFX_DIBAttribute* pAttribute) {
+bool PngDecoder::ContinueDecode(ProgressiveDecoderIface::Context* pContext,
+ RetainPtr<CFX_CodecMemory> codec_memory,
+ CFX_DIBAttribute* pAttribute) {
auto* ctx = static_cast<CPngContext*>(pContext);
if (setjmp(png_jmpbuf(ctx->m_pPng))) {
if (pAttribute &&
diff --git a/core/fxcodec/png/pngmodule.h b/core/fxcodec/png/png_decoder.h
similarity index 81%
rename from core/fxcodec/png/pngmodule.h
rename to core/fxcodec/png/png_decoder.h
index b2c0bfd..3eca876 100644
--- a/core/fxcodec/png/pngmodule.h
+++ b/core/fxcodec/png/png_decoder.h
@@ -4,8 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCODEC_PNG_PNGMODULE_H_
-#define CORE_FXCODEC_PNG_PNGMODULE_H_
+#ifndef CORE_FXCODEC_PNG_PNG_DECODER_H_
+#define CORE_FXCODEC_PNG_PNG_DECODER_H_
#include <memory>
@@ -17,7 +17,7 @@
namespace fxcodec {
-class PngModule {
+class PngDecoder {
public:
class Delegate {
public:
@@ -42,13 +42,13 @@
RetainPtr<CFX_CodecMemory> codec_memory,
CFX_DIBAttribute* pAttribute);
- PngModule() = delete;
- PngModule(const PngModule&) = delete;
- PngModule& operator=(const PngModule&) = delete;
+ PngDecoder() = delete;
+ PngDecoder(const PngDecoder&) = delete;
+ PngDecoder& operator=(const PngDecoder&) = delete;
};
} // namespace fxcodec
-using PngModule = fxcodec::PngModule;
+using PngDecoder = fxcodec::PngDecoder;
-#endif // CORE_FXCODEC_PNG_PNGMODULE_H_
+#endif // CORE_FXCODEC_PNG_PNG_DECODER_H_
diff --git a/core/fxcodec/progressivedecoder.cpp b/core/fxcodec/progressivedecoder.cpp
index 0438797..feb5fde 100644
--- a/core/fxcodec/progressivedecoder.cpp
+++ b/core/fxcodec/progressivedecoder.cpp
@@ -1190,13 +1190,13 @@
bool ProgressiveDecoder::PngDetectImageTypeInBuffer(
CFX_DIBAttribute* pAttribute) {
- m_pPngContext = PngModule::StartDecode(this);
+ m_pPngContext = PngDecoder::StartDecode(this);
if (!m_pPngContext) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
}
- while (PngModule::ContinueDecode(m_pPngContext.get(), m_pCodecMemory,
- pAttribute)) {
+ while (PngDecoder::ContinueDecode(m_pPngContext.get(), m_pCodecMemory,
+ pAttribute)) {
uint32_t remain_size = static_cast<uint32_t>(m_pFile->GetSize()) - m_offSet;
uint32_t input_size = std::min<uint32_t>(remain_size, kBlockSize);
if (input_size == 0) {
@@ -1224,7 +1224,7 @@
FXCODEC_STATUS ProgressiveDecoder::PngStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
- m_pPngContext = PngModule::StartDecode(this);
+ m_pPngContext = PngDecoder::StartDecode(this);
if (!m_pPngContext) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
@@ -1286,8 +1286,8 @@
return m_status;
}
m_offSet += input_size;
- bResult =
- PngModule::ContinueDecode(m_pPngContext.get(), m_pCodecMemory, nullptr);
+ bResult = PngDecoder::ContinueDecode(m_pPngContext.get(), m_pCodecMemory,
+ nullptr);
if (!bResult) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
diff --git a/core/fxcodec/progressivedecoder.h b/core/fxcodec/progressivedecoder.h
index 53d3413..e45cc9f 100644
--- a/core/fxcodec/progressivedecoder.h
+++ b/core/fxcodec/progressivedecoder.h
@@ -28,7 +28,7 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
-#include "core/fxcodec/png/pngmodule.h"
+#include "core/fxcodec/png/png_decoder.h"
#endif // PDF_ENABLE_XFA_PNG
class CFX_DIBitmap;
@@ -49,7 +49,7 @@
public GifModule::Delegate,
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
- public PngModule::Delegate,
+ public PngDecoder::Delegate,
#endif // PDF_ENABLE_XFA_PNG
public Dummy {
public:
@@ -141,7 +141,7 @@
};
#ifdef PDF_ENABLE_XFA_PNG
- // PngModule::Delegate
+ // PngDecoder::Delegate
bool PngReadHeader(int width,
int height,
int bpc,