1 // Copyright 2016 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_ 8 #define CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_ 9 10 #include <memory> 11 12 #include "core/fxcodec/fx_codec_def.h" 13 #include "core/fxcrt/retain_ptr.h" 14 15 class CJBig2_Context; 16 class CJBig2_Image; 17 class CPDF_StreamAcc; 18 class IFX_PauseIndicator; 19 class JBig2_DocumentContext; 20 21 class CCodec_Jbig2Context { 22 public: 23 CCodec_Jbig2Context(); 24 ~CCodec_Jbig2Context(); 25 26 uint32_t m_width; 27 uint32_t m_height; 28 RetainPtr<CPDF_StreamAcc> m_pGlobalStream; 29 RetainPtr<CPDF_StreamAcc> m_pSrcStream; 30 uint8_t* m_dest_buf; 31 uint32_t m_dest_pitch; 32 std::unique_ptr<CJBig2_Context> m_pContext; 33 }; 34 35 class CCodec_Jbig2Module { 36 public: CCodec_Jbig2Module()37 CCodec_Jbig2Module() {} 38 ~CCodec_Jbig2Module(); 39 40 FXCODEC_STATUS StartDecode( 41 CCodec_Jbig2Context* pJbig2Context, 42 std::unique_ptr<JBig2_DocumentContext>* pContextHolder, 43 uint32_t width, 44 uint32_t height, 45 const RetainPtr<CPDF_StreamAcc>& src_stream, 46 const RetainPtr<CPDF_StreamAcc>& global_stream, 47 uint8_t* dest_buf, 48 uint32_t dest_pitch, 49 IFX_PauseIndicator* pPause); 50 FXCODEC_STATUS ContinueDecode(CCodec_Jbig2Context* pJbig2Context, 51 IFX_PauseIndicator* pPause); 52 53 private: 54 FXCODEC_STATUS Decode(CCodec_Jbig2Context* pJbig2Context, int result); 55 }; 56 57 #endif // CORE_FXCODEC_CODEC_CCODEC_JBIG2MODULE_H_ 58