diff options
author | Lei Zhang <thestig@chromium.org> | 2015-09-03 14:45:32 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-09-03 14:45:32 -0700 |
commit | 928c183ece333e4eb55acbbd8036cf473b94f516 (patch) | |
tree | 6273b16804fd06cdd9a90c4c8040b9db080b17f1 /core/src/fxcodec/codec | |
parent | 55512706477c035ee27413a7a2c9a75f31ceae34 (diff) | |
download | pdfium-928c183ece333e4eb55acbbd8036cf473b94f516.tar.xz |
Merge to XFA: Remove dead JBig2 code.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1328643002 .
(cherry picked from commit 9df5d9701ddf75f8050566132694bf435efb3ca0)
Review URL: https://codereview.chromium.org/1319563003 .
Diffstat (limited to 'core/src/fxcodec/codec')
-rw-r--r-- | core/src/fxcodec/codec/codec_int.h | 20 | ||||
-rw-r--r-- | core/src/fxcodec/codec/fx_codec_jbig.cpp | 119 |
2 files changed, 0 insertions, 139 deletions
diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index 75e1fd141b..ee7fe3ba6f 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -398,19 +398,6 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module { ~CCodec_Jbig2Module() override; // ICodec_Jbig2Module - FX_BOOL Decode(FX_DWORD width, - FX_DWORD height, - const uint8_t* src_buf, - FX_DWORD src_size, - const uint8_t* global_data, - FX_DWORD global_size, - uint8_t* dest_buf, - FX_DWORD dest_pitch) override; - FX_BOOL Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& pitch, - uint8_t*& dest_buf) override; void* CreateJbig2Context() override; FXCODEC_STATUS StartDecode(void* pJbig2Context, FX_DWORD width, @@ -422,13 +409,6 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module { uint8_t* dest_buf, FX_DWORD dest_pitch, IFX_Pause* pPause) override; - FXCODEC_STATUS StartDecode(void* pJbig2Context, - IFX_FileRead* file_ptr, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& pitch, - uint8_t*& dest_buf, - IFX_Pause* pPause) override; FXCODEC_STATUS ContinueDecode(void* pJbig2Context, IFX_Pause* pPause) override; void DestroyJbig2Context(void* pJbig2Context) override; diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index 1551060b60..b95461b3e5 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -22,69 +22,6 @@ void CCodec_Jbig2Module::DestroyJbig2Context(void* pJbig2Content) { } pJbig2Content = NULL; } -FX_BOOL CCodec_Jbig2Module::Decode(FX_DWORD width, - FX_DWORD height, - const uint8_t* src_buf, - FX_DWORD src_size, - const uint8_t* global_data, - FX_DWORD global_size, - uint8_t* dest_buf, - FX_DWORD dest_pitch) { - FXSYS_memset(dest_buf, 0, height * dest_pitch); - CJBig2_Context* pContext = CJBig2_Context::CreateContext( - &m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, - src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache); - if (pContext == NULL) { - return FALSE; - } - int ret = pContext->getFirstPage(dest_buf, width, height, dest_pitch, NULL); - CJBig2_Context::DestroyContext(pContext); - if (ret != JBIG2_SUCCESS) { - return FALSE; - } - int dword_size = height * dest_pitch / 4; - FX_DWORD* dword_buf = (FX_DWORD*)dest_buf; - for (int i = 0; i < dword_size; i++) { - dword_buf[i] = ~dword_buf[i]; - } - return TRUE; -} -FX_BOOL CCodec_Jbig2Module::Decode(IFX_FileRead* file_ptr, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& pitch, - uint8_t*& dest_buf) { - CJBig2_Context* pContext = NULL; - CJBig2_Image* dest_image = NULL; - FX_DWORD src_size = (FX_DWORD)file_ptr->GetSize(); - uint8_t* src_buf = FX_Alloc(uint8_t, src_size); - int ret = 0; - if (!file_ptr->ReadBlock(src_buf, 0, src_size)) { - goto failed; - } - pContext = - CJBig2_Context::CreateContext(&m_Module, NULL, 0, src_buf, src_size, - JBIG2_FILE_STREAM, &m_SymbolDictCache); - if (pContext == NULL) { - goto failed; - } - ret = pContext->getFirstPage(&dest_image, NULL); - CJBig2_Context::DestroyContext(pContext); - if (ret != JBIG2_SUCCESS) { - goto failed; - } - width = (FX_DWORD)dest_image->m_nWidth; - height = (FX_DWORD)dest_image->m_nHeight; - pitch = (FX_DWORD)dest_image->m_nStride; - dest_buf = dest_image->m_pData; - dest_image->m_bNeedFree = FALSE; - delete dest_image; - FX_Free(src_buf); - return TRUE; -failed: - FX_Free(src_buf); - return FALSE; -} FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, FX_DWORD width, FX_DWORD height, @@ -134,62 +71,6 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, } return m_pJbig2Context->m_pContext->GetProcessiveStatus(); } -FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, - IFX_FileRead* file_ptr, - FX_DWORD& width, - FX_DWORD& height, - FX_DWORD& pitch, - uint8_t*& dest_buf, - IFX_Pause* pPause) { - if (!pJbig2Context) { - return FXCODEC_STATUS_ERR_PARAMS; - } - CCodec_Jbig2Context* m_pJbig2Context = (CCodec_Jbig2Context*)pJbig2Context; - m_pJbig2Context->m_bFileReader = TRUE; - m_pJbig2Context->m_dest_image = NULL; - m_pJbig2Context->m_src_size = (FX_DWORD)file_ptr->GetSize(); - m_pJbig2Context->m_src_buf = FX_Alloc(uint8_t, m_pJbig2Context->m_src_size); - int ret = 0; - if (!file_ptr->ReadBlock((void*)m_pJbig2Context->m_src_buf, 0, - m_pJbig2Context->m_src_size)) { - goto failed; - } - m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( - &m_Module, NULL, 0, m_pJbig2Context->m_src_buf, - m_pJbig2Context->m_src_size, JBIG2_FILE_STREAM, &m_SymbolDictCache, - pPause); - if (m_pJbig2Context->m_pContext == NULL) { - goto failed; - } - ret = m_pJbig2Context->m_pContext->getFirstPage( - &m_pJbig2Context->m_dest_image, pPause); - if (m_pJbig2Context->m_pContext->GetProcessiveStatus() == - FXCODEC_STATUS_DECODE_TOBECONTINUE) { - width = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nWidth; - height = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nHeight; - pitch = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nStride; - dest_buf = m_pJbig2Context->m_dest_image->m_pData; - m_pJbig2Context->m_dest_image->m_bNeedFree = FALSE; - return FXCODEC_STATUS_DECODE_TOBECONTINUE; - } - CJBig2_Context::DestroyContext(m_pJbig2Context->m_pContext); - m_pJbig2Context->m_pContext = NULL; - if (ret != JBIG2_SUCCESS) { - goto failed; - } - width = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nWidth; - height = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nHeight; - pitch = (FX_DWORD)m_pJbig2Context->m_dest_image->m_nStride; - dest_buf = m_pJbig2Context->m_dest_image->m_pData; - m_pJbig2Context->m_dest_image->m_bNeedFree = FALSE; - delete m_pJbig2Context->m_dest_image; - FX_Free(m_pJbig2Context->m_src_buf); - return FXCODEC_STATUS_DECODE_FINISH; -failed: - FX_Free(m_pJbig2Context->m_src_buf); - m_pJbig2Context->m_src_buf = NULL; - return FXCODEC_STATUS_ERROR; -} FXCODEC_STATUS CCodec_Jbig2Module::ContinueDecode(void* pJbig2Context, IFX_Pause* pPause) { CCodec_Jbig2Context* m_pJbig2Context = (CCodec_Jbig2Context*)pJbig2Context; |