diff options
Diffstat (limited to 'core/fxcodec/codec')
-rw-r--r-- | core/fxcodec/codec/ccodec_jbig2module.h | 7 | ||||
-rw-r--r-- | core/fxcodec/codec/fx_codec_jbig.cpp | 36 |
2 files changed, 16 insertions, 27 deletions
diff --git a/core/fxcodec/codec/ccodec_jbig2module.h b/core/fxcodec/codec/ccodec_jbig2module.h index 63e63afcfa..5d77d53619 100644 --- a/core/fxcodec/codec/ccodec_jbig2module.h +++ b/core/fxcodec/codec/ccodec_jbig2module.h @@ -20,7 +20,7 @@ class IFX_Pause; class CCodec_Jbig2Context { public: CCodec_Jbig2Context(); - ~CCodec_Jbig2Context() {} + ~CCodec_Jbig2Context(); uint32_t m_width; uint32_t m_height; @@ -29,8 +29,7 @@ class CCodec_Jbig2Context { uint8_t* m_dest_buf; uint32_t m_dest_pitch; IFX_Pause* m_pPause; - CJBig2_Context* m_pContext; - CJBig2_Image* m_dest_image; + std::unique_ptr<CJBig2_Context> m_pContext; }; class CCodec_Jbig2Module { @@ -38,7 +37,6 @@ class CCodec_Jbig2Module { CCodec_Jbig2Module() {} ~CCodec_Jbig2Module(); - CCodec_Jbig2Context* CreateJbig2Context(); FXCODEC_STATUS StartDecode(CCodec_Jbig2Context* pJbig2Context, std::unique_ptr<CFX_Deletable>* pContextHolder, uint32_t width, @@ -50,7 +48,6 @@ class CCodec_Jbig2Module { IFX_Pause* pPause); FXCODEC_STATUS ContinueDecode(CCodec_Jbig2Context* pJbig2Context, IFX_Pause* pPause); - void DestroyJbig2Context(CCodec_Jbig2Context* pJbig2Context); }; #endif // CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_ diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 4876cef53d..8f2d07f490 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -37,24 +37,18 @@ JBig2DocumentContext* GetJBig2DocumentContext( return static_cast<JBig2DocumentContext*>(pContextHolder->get()); } -CCodec_Jbig2Context::CCodec_Jbig2Context() { - FXSYS_memset(this, 0, sizeof(CCodec_Jbig2Context)); -} - -CCodec_Jbig2Module::~CCodec_Jbig2Module() {} +CCodec_Jbig2Context::CCodec_Jbig2Context() + : m_width(0), + m_height(0), + m_pGlobalStream(nullptr), + m_pSrcStream(nullptr), + m_dest_buf(0), + m_dest_pitch(0), + m_pPause(nullptr) {} -CCodec_Jbig2Context* CCodec_Jbig2Module::CreateJbig2Context() { - return new CCodec_Jbig2Context(); -} +CCodec_Jbig2Context::~CCodec_Jbig2Context() {} -void CCodec_Jbig2Module::DestroyJbig2Context( - CCodec_Jbig2Context* pJbig2Context) { - if (pJbig2Context) { - CJBig2_Context::DestroyContext(pJbig2Context->m_pContext); - delete pJbig2Context; - } - pJbig2Context = nullptr; -} +CCodec_Jbig2Module::~CCodec_Jbig2Module() {} FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( CCodec_Jbig2Context* pJbig2Context, @@ -79,9 +73,9 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( pJbig2Context->m_dest_pitch = dest_pitch; pJbig2Context->m_pPause = pPause; FXSYS_memset(dest_buf, 0, height * dest_pitch); - pJbig2Context->m_pContext = CJBig2_Context::CreateContext( + pJbig2Context->m_pContext.reset(new CJBig2_Context( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), - pPause); + pPause, false)); if (!pJbig2Context->m_pContext) return FXCODEC_STATUS_ERROR; @@ -89,8 +83,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( dest_pitch, pPause); if (pJbig2Context->m_pContext->GetProcessingStatus() == FXCODEC_STATUS_DECODE_FINISH) { - CJBig2_Context::DestroyContext(pJbig2Context->m_pContext); - pJbig2Context->m_pContext = nullptr; + pJbig2Context->m_pContext.reset(); if (ret != JBIG2_SUCCESS) return FXCODEC_STATUS_ERROR; @@ -111,8 +104,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode( FXCODEC_STATUS_DECODE_FINISH) { return pJbig2Context->m_pContext->GetProcessingStatus(); } - CJBig2_Context::DestroyContext(pJbig2Context->m_pContext); - pJbig2Context->m_pContext = nullptr; + pJbig2Context->m_pContext.reset(); if (ret != JBIG2_SUCCESS) return FXCODEC_STATUS_ERROR; |