summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_pngmodule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcodec/codec/ccodec_pngmodule.cpp')
-rw-r--r--core/fxcodec/codec/ccodec_pngmodule.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/core/fxcodec/codec/ccodec_pngmodule.cpp b/core/fxcodec/codec/ccodec_pngmodule.cpp
index d3e24cd9ea..028513b729 100644
--- a/core/fxcodec/codec/ccodec_pngmodule.cpp
+++ b/core/fxcodec/codec/ccodec_pngmodule.cpp
@@ -97,7 +97,6 @@ struct FXPNG_Context {
png_structp png_ptr;
png_infop info_ptr;
void* parent_ptr;
- void* child_ptr;
void* (*m_AllocFunc)(unsigned int);
void (*m_FreeFunc)(void*);
@@ -135,8 +134,8 @@ static void _png_get_header_func(png_structp png_ptr, png_infop info_ptr) {
png_set_palette_to_rgb(png_ptr);
}
pass = png_set_interlace_handling(png_ptr);
- if (!pModule->ReadHeaderCallback(p->child_ptr, width, height, bpc, pass,
- &color_type, &gamma)) {
+ if (!pModule->GetDelegate()->PngReadHeader(width, height, bpc, pass,
+ &color_type, &gamma)) {
png_error(p->png_ptr, "Read Header Callback Error");
}
int intent;
@@ -189,16 +188,22 @@ static void _png_get_row_func(png_structp png_ptr,
CCodec_PngModule* pModule = (CCodec_PngModule*)p->parent_ptr;
uint8_t* src_buf = nullptr;
- if (!pModule->AskScanlineBufCallback(p->child_ptr, row_num, src_buf)) {
+ if (!pModule->GetDelegate()->PngAskScanlineBuf(row_num, src_buf)) {
png_error(png_ptr, "Ask Scanline buffer Callback Error");
}
if (src_buf) {
png_progressive_combine_row(png_ptr, src_buf, new_row);
}
- pModule->FillScanlineBufCompletedCallback(p->child_ptr, pass, row_num);
+ pModule->GetDelegate()->PngFillScanlineBufCompleted(pass, row_num);
}
-FXPNG_Context* CCodec_PngModule::Start(void* pModule) {
+CCodec_PngModule::CCodec_PngModule() {
+ memset(m_szLastError, 0, sizeof(m_szLastError));
+}
+
+CCodec_PngModule::~CCodec_PngModule() {}
+
+FXPNG_Context* CCodec_PngModule::Start() {
FXPNG_Context* p = FX_Alloc(FXPNG_Context, 1);
if (!p)
return nullptr;
@@ -208,7 +213,6 @@ FXPNG_Context* CCodec_PngModule::Start(void* pModule) {
p->png_ptr = nullptr;
p->info_ptr = nullptr;
p->parent_ptr = (void*)this;
- p->child_ptr = pModule;
p->png_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (!p->png_ptr) {