diff options
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.h')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.h | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index e1ee679de7..148866a914 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -28,15 +28,18 @@ using CJBig2_CacheKey = std::pair<uint32_t, uint32_t>; using CJBig2_CachePair = std::pair<CJBig2_CacheKey, std::unique_ptr<CJBig2_SymbolDict>>; -#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_LIMIT -6 #define JBIG2_MIN_SEGMENT_SIZE 11 +enum class JBig2_Result { + Success, + Failure, + ErrorTooShort, + ErrorFatal, + ErrorLimit, + EndOfPage, + EndOfFile +}; + class CJBig2_Context { public: CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream, @@ -47,40 +50,40 @@ class CJBig2_Context { static bool HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, uint32_t NTEMP); - int32_t GetFirstPage(uint8_t* pBuf, - int32_t width, - int32_t height, - int32_t stride, - PauseIndicatorIface* pPause); + bool GetFirstPage(uint8_t* pBuf, + int32_t width, + int32_t height, + int32_t stride, + PauseIndicatorIface* pPause); - int32_t Continue(PauseIndicatorIface* pPause); + bool Continue(PauseIndicatorIface* pPause); FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; } private: - int32_t DecodeSequential(PauseIndicatorIface* pPause); - int32_t DecodeRandomFirstPage(PauseIndicatorIface* pPause); - int32_t DecodeRandom(PauseIndicatorIface* pPause); + JBig2_Result DecodeSequential(PauseIndicatorIface* pPause); + JBig2_Result DecodeRandomFirstPage(PauseIndicatorIface* pPause); + JBig2_Result DecodeRandom(PauseIndicatorIface* pPause); CJBig2_Segment* FindSegmentByNumber(uint32_t dwNumber); CJBig2_Segment* FindReferredTableSegmentByIndex(CJBig2_Segment* pSegment, int32_t nIndex); - int32_t ParseSegmentHeader(CJBig2_Segment* pSegment); - int32_t ParseSegmentData(CJBig2_Segment* pSegment, - PauseIndicatorIface* pPause); - int32_t ProcessingParseSegmentData(CJBig2_Segment* pSegment, - PauseIndicatorIface* pPause); - int32_t ParseSymbolDict(CJBig2_Segment* pSegment); - int32_t ParseTextRegion(CJBig2_Segment* pSegment); - int32_t ParsePatternDict(CJBig2_Segment* pSegment, - PauseIndicatorIface* pPause); - int32_t ParseHalftoneRegion(CJBig2_Segment* pSegment, - PauseIndicatorIface* pPause); - int32_t ParseGenericRegion(CJBig2_Segment* pSegment, - PauseIndicatorIface* pPause); - int32_t ParseGenericRefinementRegion(CJBig2_Segment* pSegment); - int32_t ParseTable(CJBig2_Segment* pSegment); - int32_t ParseRegionInfo(JBig2RegionInfo* pRI); + JBig2_Result ParseSegmentHeader(CJBig2_Segment* pSegment); + JBig2_Result ParseSegmentData(CJBig2_Segment* pSegment, + PauseIndicatorIface* pPause); + JBig2_Result ProcessingParseSegmentData(CJBig2_Segment* pSegment, + PauseIndicatorIface* pPause); + JBig2_Result ParseSymbolDict(CJBig2_Segment* pSegment); + JBig2_Result ParseTextRegion(CJBig2_Segment* pSegment); + JBig2_Result ParsePatternDict(CJBig2_Segment* pSegment, + PauseIndicatorIface* pPause); + JBig2_Result ParseHalftoneRegion(CJBig2_Segment* pSegment, + PauseIndicatorIface* pPause); + JBig2_Result ParseGenericRegion(CJBig2_Segment* pSegment, + PauseIndicatorIface* pPause); + JBig2_Result ParseGenericRefinementRegion(CJBig2_Segment* pSegment); + JBig2_Result ParseTable(CJBig2_Segment* pSegment); + JBig2_Result ParseRegionInfo(JBig2RegionInfo* pRI); std::vector<JBig2HuffmanCode> DecodeSymbolIDHuffmanTable(uint32_t SBNUMSYMS); |