Rename CCodec_PngModule to fxcodec::PngModule.
BUG=pdfium:1311
Change-Id: I61f71c7ae30a7e461875c0475148cdbfd433c306
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55812
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 c8cc854..936e13b 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -111,8 +111,8 @@
}
if (pdf_enable_xfa_png) {
sources += [
- "codec/ccodec_pngmodule.cpp",
- "codec/ccodec_pngmodule.h",
+ "codec/pngmodule.cpp",
+ "codec/pngmodule.h",
]
deps += [ "../../third_party:png" ]
}
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index d3705d3..b2af93c 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -1251,7 +1251,7 @@
bool CCodec_ProgressiveDecoder::PngDetectImageTypeInBuffer(
CFX_DIBAttribute* pAttribute) {
- CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
+ PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return false;
@@ -1290,7 +1290,7 @@
FXCODEC_STATUS CCodec_ProgressiveDecoder::PngStartDecode(
const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
- CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
+ PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
m_pDeviceBitmap = nullptr;
m_pFile = nullptr;
@@ -1337,7 +1337,7 @@
}
FXCODEC_STATUS CCodec_ProgressiveDecoder::PngContinueDecode() {
- CCodec_PngModule* pPngModule = m_pCodecMgr->GetPngModule();
+ PngModule* pPngModule = m_pCodecMgr->GetPngModule();
if (!pPngModule) {
m_status = FXCODEC_STATUS_ERR_MEMORY;
return m_status;
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index ee4fb1f..ab91bb1 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -27,7 +27,7 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
+#include "core/fxcodec/codec/pngmodule.h"
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_TIFF
@@ -49,7 +49,7 @@
public GifModule::Delegate,
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
- public CCodec_PngModule::Delegate,
+ public PngModule::Delegate,
#endif // PDF_ENABLE_XFA_PNG
public CCodec_Dummy {
public:
@@ -146,7 +146,7 @@
};
#ifdef PDF_ENABLE_XFA_PNG
- // CCodec_PngModule::Delegate
+ // PngModule::Delegate
bool PngReadHeader(int width,
int height,
int bpc,
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index 7342216..3748267 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -56,7 +56,7 @@
#endif
#ifdef PDF_ENABLE_XFA_PNG
- SetPngModule(pdfium::MakeUnique<CCodec_PngModule>());
+ SetPngModule(pdfium::MakeUnique<PngModule>());
#endif
#ifdef PDF_ENABLE_XFA_TIFF
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/pngmodule.cpp
similarity index 91%
rename from core/fxcodec/codec/ccodec_pngmodule.cpp
rename to core/fxcodec/codec/pngmodule.cpp
index dec3f7b..19fa62c 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/pngmodule.cpp
@@ -4,7 +4,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
+#include "core/fxcodec/codec/pngmodule.h"
#include <algorithm>
@@ -26,12 +26,12 @@
class CPngContext final : public CodecModuleIface::Context {
public:
- explicit CPngContext(CCodec_PngModule::Delegate* pDelegate);
+ explicit CPngContext(PngModule::Delegate* pDelegate);
~CPngContext() override;
png_structp m_pPng = nullptr;
png_infop m_pInfo = nullptr;
- UnownedPtr<CCodec_PngModule::Delegate> const m_pDelegate;
+ UnownedPtr<PngModule::Delegate> const m_pDelegate;
char m_szLastError[PNG_ERROR_SIZE];
};
@@ -173,7 +173,7 @@
} // extern "C"
-CPngContext::CPngContext(CCodec_PngModule::Delegate* pDelegate)
+CPngContext::CPngContext(PngModule::Delegate* pDelegate)
: m_pDelegate(pDelegate) {
memset(m_szLastError, 0, sizeof(m_szLastError));
}
@@ -183,7 +183,13 @@
m_pInfo ? &m_pInfo : nullptr, nullptr);
}
-std::unique_ptr<CodecModuleIface::Context> CCodec_PngModule::Start(
+namespace fxcodec {
+
+PngModule::PngModule() = default;
+
+PngModule::~PngModule() = default;
+
+std::unique_ptr<CodecModuleIface::Context> PngModule::Start(
Delegate* pDelegate) {
auto p = pdfium::MakeUnique<CPngContext>(pDelegate);
p->m_pPng =
@@ -205,14 +211,14 @@
return p;
}
-FX_FILESIZE CCodec_PngModule::GetAvailInput(Context* pContext) const {
+FX_FILESIZE PngModule::GetAvailInput(Context* pContext) const {
NOTREACHED();
return 0;
}
-bool CCodec_PngModule::Input(Context* pContext,
- RetainPtr<CFX_CodecMemory> codec_memory,
- CFX_DIBAttribute* pAttribute) {
+bool PngModule::Input(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 &&
@@ -225,3 +231,5 @@
png_process_data(ctx->m_pPng, ctx->m_pInfo, src_buf.data(), src_buf.size());
return true;
}
+
+} // namespace fxcodec
diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/pngmodule.h
similarity index 79%
rename from core/fxcodec/codec/ccodec_pngmodule.h
rename to core/fxcodec/codec/pngmodule.h
index d736528..946ad07 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.h
+++ b/core/fxcodec/codec/pngmodule.h
@@ -4,14 +4,16 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_
-#define CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_
+#ifndef CORE_FXCODEC_CODEC_PNGMODULE_H_
+#define CORE_FXCODEC_CODEC_PNGMODULE_H_
#include <memory>
#include "core/fxcodec/codec/codec_module_iface.h"
-class CCodec_PngModule final : public CodecModuleIface {
+namespace fxcodec {
+
+class PngModule final : public CodecModuleIface {
public:
class Delegate {
public:
@@ -29,6 +31,9 @@
virtual void PngFillScanlineBufCompleted(int pass, int line) = 0;
};
+ PngModule();
+ ~PngModule() override;
+
// CodecModuleIface:
FX_FILESIZE GetAvailInput(Context* pContext) const override;
bool Input(Context* pContext,
@@ -38,4 +43,8 @@
std::unique_ptr<Context> Start(Delegate* pDelegate);
};
-#endif // CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_
+} // namespace fxcodec
+
+using PngModule = fxcodec::PngModule;
+
+#endif // CORE_FXCODEC_CODEC_PNGMODULE_H_
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 4154f06..1d4a9c6 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -26,7 +26,7 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
-#include "core/fxcodec/codec/ccodec_pngmodule.h"
+#include "core/fxcodec/codec/pngmodule.h"
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_TIFF
@@ -80,8 +80,8 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
- CCodec_PngModule* GetPngModule() const { return m_pPngModule.get(); }
- void SetPngModule(std::unique_ptr<CCodec_PngModule> module) {
+ PngModule* GetPngModule() const { return m_pPngModule.get(); }
+ void SetPngModule(std::unique_ptr<PngModule> module) {
m_pPngModule = std::move(module);
}
#endif // PDF_ENABLE_XFA_PNG
@@ -111,7 +111,7 @@
#endif // PDF_ENABLE_XFA_GIF
#ifdef PDF_ENABLE_XFA_PNG
- std::unique_ptr<CCodec_PngModule> m_pPngModule;
+ std::unique_ptr<PngModule> m_pPngModule;
#endif // PDF_ENABLE_XFA_PNG
#ifdef PDF_ENABLE_XFA_TIFF