From db9faec3c8fb3ced3d8340b2b6ae252b8f40d135 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 31 May 2017 16:29:29 -0700 Subject: Put all CCodec_PngModule state into its context. Rename FXPNG_Context and use unowned ptr. Clean up context in its dtor. Then create and destroy using |new|. Change-Id: I7b66e6d0da50a16d3b8d5108ffd931bb01145892 Reviewed-on: https://pdfium-review.googlesource.com/6152 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fxcodec/codec/ccodec_pngmodule.h | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'core/fxcodec/codec/ccodec_pngmodule.h') diff --git a/core/fxcodec/codec/ccodec_pngmodule.h b/core/fxcodec/codec/ccodec_pngmodule.h index 2b43f5d8bc..b92e09cc71 100644 --- a/core/fxcodec/codec/ccodec_pngmodule.h +++ b/core/fxcodec/codec/ccodec_pngmodule.h @@ -11,12 +11,10 @@ #include "core/fxcrt/fx_system.h" class CFX_DIBAttribute; -struct FXPNG_Context; - -#define PNG_ERROR_SIZE 256 class CCodec_PngModule { public: + class Context; class Delegate { public: virtual bool PngReadHeader(int width, @@ -29,22 +27,12 @@ class CCodec_PngModule { virtual void PngFillScanlineBufCompleted(int pass, int line) = 0; }; - CCodec_PngModule(); - ~CCodec_PngModule(); - - FXPNG_Context* Start(); - void Finish(FXPNG_Context* pContext); - bool Input(FXPNG_Context* pContext, + Context* Start(Delegate* pDelegate); + void Finish(Context* pContext); + bool Input(Context* pContext, const uint8_t* src_buf, uint32_t src_size, CFX_DIBAttribute* pAttribute); - - Delegate* GetDelegate() const { return m_pDelegate.Get(); } - void SetDelegate(Delegate* delegate) { m_pDelegate = delegate; } - - protected: - CFX_UnownedPtr m_pDelegate; - char m_szLastError[PNG_ERROR_SIZE]; }; #endif // CORE_FXCODEC_CODEC_CCODEC_PNGMODULE_H_ -- cgit v1.2.3