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/lgif/cgifcontext.h | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'core/fxcodec/lgif/cgifcontext.h') diff --git a/core/fxcodec/lgif/cgifcontext.h b/core/fxcodec/lgif/cgifcontext.h index 20d640ef35..fa46b14559 100644 --- a/core/fxcodec/lgif/cgifcontext.h +++ b/core/fxcodec/lgif/cgifcontext.h @@ -10,16 +10,16 @@ #include #include +#include "core/fxcodec/codec/ccodec_gifmodule.h" #include "core/fxcodec/lgif/fx_gif.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_basic.h" -class CCodec_GifModule; - -class CGifContext { +class CGifContext : public CCodec_GifModule::Context { public: - CGifContext(CCodec_GifModule* gif_module, char* error_string); - ~CGifContext(); + CGifContext(CCodec_GifModule* gif_module, + CCodec_GifModule::Delegate* pDelegate); + ~CGifContext() override; void AddError(const char* err_msg); void RecordCurrentPosition(uint32_t* cur_pos_ptr); @@ -37,6 +37,8 @@ class CGifContext { int32_t disposal_method, bool interlace); + CFX_UnownedPtr m_pModule; + CFX_UnownedPtr m_pDelegate; std::vector m_GlobalPalette; int32_t global_pal_num; uint32_t img_row_offset; @@ -44,23 +46,19 @@ class CGifContext { uint32_t avail_in; int32_t decode_status; uint32_t skip_size; - - CFX_UnownedPtr m_Module; - char* err_ptr; CFX_ByteString cmt_data; std::unique_ptr m_GifGCE; uint8_t* next_in; std::vector> m_Images; std::unique_ptr m_ImgDecoder; - int width; int height; - uint8_t bc_index; uint8_t pixel_aspect; uint8_t global_sort_flag; uint8_t global_color_resolution; uint8_t img_pass_num; + char m_szLastError[GIF_MAX_ERROR_SIZE]; }; #endif // CORE_FXCODEC_LGIF_CGIFCONTEXT_H_ -- cgit v1.2.3