From 5f34d479d06ebab9079c2d0704dee872cc45dd86 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 1 Jun 2017 10:18:53 -0700 Subject: Move CCodec_GifModule state to CGifContext Introduce a base CCodec_GifModule::Context class with a virtual destructor so holders of unique_ptr's to these can delete them without actually having any knowledge of the implementation details of the context. Bug: 728669 Change-Id: Ia50f94300924a1053c326984eac3b03f25f1b83c Reviewed-on: https://pdfium-review.googlesource.com/6190 Commit-Queue: Tom Sepez Reviewed-by: Lei Zhang --- core/fxcodec/codec/ccodec_gifmodule.h | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'core/fxcodec/codec/ccodec_gifmodule.h') diff --git a/core/fxcodec/codec/ccodec_gifmodule.h b/core/fxcodec/codec/ccodec_gifmodule.h index 2ccd4f407a..fe1c46478d 100644 --- a/core/fxcodec/codec/ccodec_gifmodule.h +++ b/core/fxcodec/codec/ccodec_gifmodule.h @@ -10,7 +10,6 @@ #include #include "core/fxcodec/lgif/fx_gif.h" -#include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_system.h" @@ -18,6 +17,11 @@ class CFX_DIBAttribute; class CCodec_GifModule { public: + class Context { + public: + virtual ~Context() {} + }; + class Delegate { public: virtual void GifRecordCurrentPosition(uint32_t& cur_pos) = 0; @@ -36,31 +40,20 @@ class CCodec_GifModule { CCodec_GifModule(); ~CCodec_GifModule(); - std::unique_ptr Start(); - uint32_t GetAvailInput(CGifContext* context, - uint8_t** avail_buf_ptr = nullptr); - - void Input(CGifContext* context, const uint8_t* src_buf, uint32_t src_size); - - GifDecodeStatus ReadHeader(CGifContext* context, + std::unique_ptr Start(Delegate* pDelegate); + uint32_t GetAvailInput(Context* context, uint8_t** avail_buf_ptr = nullptr); + void Input(Context* context, const uint8_t* src_buf, uint32_t src_size); + GifDecodeStatus ReadHeader(Context* context, int* width, int* height, int* pal_num, void** pal_pp, int* bg_index, CFX_DIBAttribute* pAttribute); - - GifDecodeStatus LoadFrameInfo(CGifContext* context, int* frame_num); - GifDecodeStatus LoadFrame(CGifContext* context, + GifDecodeStatus LoadFrameInfo(Context* context, int* frame_num); + GifDecodeStatus LoadFrame(Context* context, int frame_num, CFX_DIBAttribute* pAttribute); - - Delegate* GetDelegate() const { return m_pDelegate.Get(); } - void SetDelegate(Delegate* pDelegate) { m_pDelegate = pDelegate; } - - protected: - CFX_UnownedPtr m_pDelegate; - char m_szLastError[256]; }; #endif // CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_ -- cgit v1.2.3