summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_gifmodule.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-06-01 10:18:53 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-06-01 19:12:48 +0000
commit5f34d479d06ebab9079c2d0704dee872cc45dd86 (patch)
treeabcde4e8d564fbfbc2e1c89e96ba2d30e74be1e8 /core/fxcodec/codec/ccodec_gifmodule.h
parent1fed5a255f03232f74db882bb0d39df340479da4 (diff)
downloadpdfium-5f34d479d06ebab9079c2d0704dee872cc45dd86.tar.xz
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 <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_gifmodule.h')
-rw-r--r--core/fxcodec/codec/ccodec_gifmodule.h29
1 files changed, 11 insertions, 18 deletions
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 <memory>
#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<CGifContext> 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<Context> 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<Delegate> m_pDelegate;
- char m_szLastError[256];
};
#endif // CORE_FXCODEC_CODEC_CCODEC_GIFMODULE_H_