diff options
author | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
---|---|---|
committer | Nico Weber <thakis@chromium.org> | 2015-08-04 13:00:21 -0700 |
commit | 9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f (patch) | |
tree | c97037f398d714665aefccb6eb54d0969ad7030c /core/src/fxcodec/jbig2/JBig2_Context.h | |
parent | 780cee82236d1b3b0f9b01a22424e4b8ec9a6f12 (diff) | |
download | pdfium-9d8ec5a6e37e8d1d4d4edca9040de234e2d4728f.tar.xz |
XFA: clang-format all pdfium code.
No behavior change.
Generated by:
find . -name '*.cpp' -o -name '*.h' | \
grep -E -v 'third_party|thirdparties|lpng_v163|tiff_v403' | \
xargs ../../buildtools/mac/clang-format -i
Then manually merged https://codereview.chromium.org/1269223002/
See thread "tabs vs spaces" on pdfium@googlegroups.com for discussion.
BUG=none
Diffstat (limited to 'core/src/fxcodec/jbig2/JBig2_Context.h')
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_Context.h | 174 |
1 files changed, 95 insertions, 79 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index e6a0d7b3bc..07f886ee49 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -19,123 +19,139 @@ typedef std::pair<uint8_t*, CJBig2_SymbolDict*> CJBig2_CachePair; typedef enum { - JBIG2_OUT_OF_PAGE = 0, - JBIG2_IN_PAGE, + JBIG2_OUT_OF_PAGE = 0, + JBIG2_IN_PAGE, } JBig2State; -#define JBIG2_SUCCESS 0 -#define JBIG2_FAILED -1 -#define JBIG2_ERROR_TOO_SHORT -2 -#define JBIG2_ERROR_FATAL -3 -#define JBIG2_END_OF_PAGE 2 -#define JBIG2_END_OF_FILE 3 +#define JBIG2_SUCCESS 0 +#define JBIG2_FAILED -1 +#define JBIG2_ERROR_TOO_SHORT -2 +#define JBIG2_ERROR_FATAL -3 +#define JBIG2_END_OF_PAGE 2 +#define JBIG2_END_OF_FILE 3 #define JBIG2_ERROR_FILE_FORMAT -4 #define JBIG2_ERROR_STREAM_TYPE -5 -#define JBIG2_ERROR_LIMIT -6 -#define JBIG2_FILE_STREAM 0 -#define JBIG2_SQUENTIAL_STREAM 1 -#define JBIG2_RANDOM_STREAM 2 -#define JBIG2_EMBED_STREAM 3 -#define JBIG2_MIN_SEGMENT_SIZE 11 -class CJBig2_Context : public CJBig2_Object -{ -public: +#define JBIG2_ERROR_LIMIT -6 +#define JBIG2_FILE_STREAM 0 +#define JBIG2_SQUENTIAL_STREAM 1 +#define JBIG2_RANDOM_STREAM 2 +#define JBIG2_EMBED_STREAM 3 +#define JBIG2_MIN_SEGMENT_SIZE 11 +class CJBig2_Context : public CJBig2_Object { + public: + static CJBig2_Context* CreateContext( + CJBig2_Module* pModule, + uint8_t* pGlobalData, + FX_DWORD dwGlobalLength, + uint8_t* pData, + FX_DWORD dwLength, + int32_t nStreamType, + std::list<CJBig2_CachePair>* pSymbolDictCache, + IFX_Pause* pPause = NULL); - static CJBig2_Context *CreateContext(CJBig2_Module *pModule, uint8_t *pGlobalData, FX_DWORD dwGlobalLength, - uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause = NULL); + static void DestroyContext(CJBig2_Context* pContext); - static void DestroyContext(CJBig2_Context *pContext); + int32_t getFirstPage(uint8_t* pBuf, + int32_t width, + int32_t height, + int32_t stride, + IFX_Pause* pPause); - int32_t getFirstPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); + int32_t getNextPage(uint8_t* pBuf, + int32_t width, + int32_t height, + int32_t stride, + IFX_Pause* pPause); - int32_t getNextPage(uint8_t *pBuf, int32_t width, int32_t height, int32_t stride, IFX_Pause* pPause); + int32_t getFirstPage(CJBig2_Image** image, IFX_Pause* pPause); - int32_t getFirstPage(CJBig2_Image **image, IFX_Pause* pPause); + int32_t getNextPage(CJBig2_Image** image, IFX_Pause* pPause); + int32_t Continue(IFX_Pause* pPause); + FXCODEC_STATUS GetProcessiveStatus() { return m_ProcessiveStatus; }; - int32_t getNextPage(CJBig2_Image **image, IFX_Pause* pPause); - int32_t Continue(IFX_Pause* pPause); - FXCODEC_STATUS GetProcessiveStatus() - { - return m_ProcessiveStatus; - }; -private: + private: + CJBig2_Context(uint8_t* pGlobalData, + FX_DWORD dwGlobalLength, + uint8_t* pData, + FX_DWORD dwLength, + int32_t nStreamType, + std::list<CJBig2_CachePair>* pSymbolDictCache, + IFX_Pause* pPause); - CJBig2_Context(uint8_t *pGlobalData, FX_DWORD dwGlobalLength, - uint8_t *pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause); + ~CJBig2_Context(); - ~CJBig2_Context(); + int32_t decodeFile(IFX_Pause* pPause); - int32_t decodeFile(IFX_Pause* pPause); + int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); - int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); + int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); - int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); - int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); + int32_t decode_RandomOrgnazation(IFX_Pause* pPause); - int32_t decode_RandomOrgnazation(IFX_Pause* pPause); + CJBig2_Segment* findSegmentByNumber(FX_DWORD dwNumber); - CJBig2_Segment *findSegmentByNumber(FX_DWORD dwNumber); + CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, + uint8_t cType, + int32_t nIndex); - CJBig2_Segment *findReferredSegmentByTypeAndIndex(CJBig2_Segment *pSegment, uint8_t cType, int32_t nIndex); + int32_t parseSegmentHeader(CJBig2_Segment* pSegment); - int32_t parseSegmentHeader(CJBig2_Segment *pSegment); + int32_t parseSegmentData(CJBig2_Segment* pSegment, IFX_Pause* pPause); + int32_t ProcessiveParseSegmentData(CJBig2_Segment* pSegment, + IFX_Pause* pPause); - int32_t parseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); - int32_t ProcessiveParseSegmentData(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseSymbolDict(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parseSymbolDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseTextRegion(CJBig2_Segment* pSegment); - int32_t parseTextRegion(CJBig2_Segment *pSegment); + int32_t parsePatternDict(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parsePatternDict(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseHalftoneRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parseHalftoneRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause); - int32_t parseGenericRegion(CJBig2_Segment *pSegment, IFX_Pause* pPause); + int32_t parseGenericRefinementRegion(CJBig2_Segment* pSegment); - int32_t parseGenericRefinementRegion(CJBig2_Segment *pSegment); + int32_t parseTable(CJBig2_Segment* pSegment); - int32_t parseTable(CJBig2_Segment *pSegment); + int32_t parseRegionInfo(JBig2RegionInfo* pRI); - int32_t parseRegionInfo(JBig2RegionInfo *pRI); + JBig2HuffmanCode* decodeSymbolIDHuffmanTable(CJBig2_BitStream* pStream, + FX_DWORD SBNUMSYMS); + void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); + void huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP); - JBig2HuffmanCode *decodeSymbolIDHuffmanTable(CJBig2_BitStream *pStream, FX_DWORD SBNUMSYMS); + private: + CJBig2_Context* m_pGlobalContext; - void huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP); + int32_t m_nStreamType; - void huffman_assign_code(JBig2HuffmanCode *SBSYMCODES, int NTEMP); + CJBig2_BitStream* m_pStream; -private: + int32_t m_nState; - CJBig2_Context *m_pGlobalContext; + CJBig2_List<CJBig2_Segment>* m_pSegmentList; - int32_t m_nStreamType; + CJBig2_List<JBig2PageInfo>* m_pPageInfoList; - CJBig2_BitStream *m_pStream; + CJBig2_Image* m_pPage; - int32_t m_nState; + FX_BOOL m_bBufSpecified; - CJBig2_List<CJBig2_Segment> *m_pSegmentList; - - CJBig2_List<JBig2PageInfo> *m_pPageInfoList; - - CJBig2_Image *m_pPage; - - FX_BOOL m_bBufSpecified; - - int32_t m_nSegmentDecoded; - IFX_Pause* m_pPause; - int32_t m_PauseStep; - FXCODEC_STATUS m_ProcessiveStatus; - FX_BOOL m_bFirstPage; - CJBig2_ArithDecoder *m_pArithDecoder; - CJBig2_GRDProc *m_pGRD; - JBig2ArithCtx *m_gbContext; - CJBig2_Segment *m_pSegment; - FX_DWORD m_dwOffset; - JBig2RegionInfo m_ri; - std::list<CJBig2_CachePair>* m_pSymbolDictCache; + int32_t m_nSegmentDecoded; + IFX_Pause* m_pPause; + int32_t m_PauseStep; + FXCODEC_STATUS m_ProcessiveStatus; + FX_BOOL m_bFirstPage; + CJBig2_ArithDecoder* m_pArithDecoder; + CJBig2_GRDProc* m_pGRD; + JBig2ArithCtx* m_gbContext; + CJBig2_Segment* m_pSegment; + FX_DWORD m_dwOffset; + JBig2RegionInfo m_ri; + std::list<CJBig2_CachePair>* m_pSymbolDictCache; }; #endif |