summaryrefslogtreecommitdiff
path: root/core/fxcodec/codec/ccodec_bmpmodule.h
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-31 15:18:28 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-31 22:49:33 +0000
commitfc04f41200e4ba4f47f52f188708547e8a1bee6d (patch)
tree93e09a89b3dac5a3801be2e0820bc77adecd8f60 /core/fxcodec/codec/ccodec_bmpmodule.h
parentd9dc962586d17ab113f1ad3abefc0fa2758c9d26 (diff)
downloadpdfium-fc04f41200e4ba4f47f52f188708547e8a1bee6d.tar.xz
Move all of ccodec_bmpmodule state to its context
This avoids a stale delegate pointer issue in the module. In theory, it should also allow for multiple decodes at the same time from different contexts within the same module, but this isn't used. Rename associated context, and use |new| to create it. Along the way, resolve a subtle FX_Alloc() vs. user-supplied callback free() issue, and remove supporting code. Bug: 728323 Change-Id: I7bb66bb5d5b4fa173bec2b445a8e71ab691fdf5c Reviewed-on: https://pdfium-review.googlesource.com/6133 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcodec/codec/ccodec_bmpmodule.h')
-rw-r--r--core/fxcodec/codec/ccodec_bmpmodule.h22
1 files changed, 7 insertions, 15 deletions
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/ccodec_bmpmodule.h
index c9fcabb2bd..7893fba4c7 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.h
+++ b/core/fxcodec/codec/ccodec_bmpmodule.h
@@ -11,10 +11,10 @@
#include "core/fxcrt/fx_system.h"
class CFX_DIBAttribute;
-struct FXBMP_Context;
class CCodec_BmpModule {
public:
+ class Context;
class Delegate {
public:
virtual bool BmpInputImagePositionBuf(uint32_t rcd_pos) = 0;
@@ -24,13 +24,11 @@ class CCodec_BmpModule {
CCodec_BmpModule();
~CCodec_BmpModule();
- FXBMP_Context* Start();
- void Finish(FXBMP_Context* pContext);
- uint32_t GetAvailInput(FXBMP_Context* pContext, uint8_t** avail_buf_ptr);
- void Input(FXBMP_Context* pContext,
- const uint8_t* src_buf,
- uint32_t src_size);
- int32_t ReadHeader(FXBMP_Context* pContext,
+ Context* Start(Delegate* pDelegate);
+ void Finish(Context* pContext);
+ uint32_t GetAvailInput(Context* pContext, uint8_t** avail_buf_ptr);
+ void Input(Context* pContext, const uint8_t* src_buf, uint32_t src_size);
+ int32_t ReadHeader(Context* pContext,
int32_t* width,
int32_t* height,
bool* tb_flag,
@@ -38,13 +36,7 @@ class CCodec_BmpModule {
int32_t* pal_num,
uint32_t** pal_pp,
CFX_DIBAttribute* pAttribute);
- int32_t LoadImage(FXBMP_Context* pContext);
- Delegate* GetDelegate() const { return m_pDelegate.Get(); }
- void SetDelegate(Delegate* pDelegate) { m_pDelegate = pDelegate; }
-
- protected:
- CFX_UnownedPtr<Delegate> m_pDelegate;
- char m_szLastError[256];
+ int32_t LoadImage(Context* pContext);
};
#endif // CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_