OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _JBIG2_SEGMENT_H_ | 7 #ifndef _JBIG2_SEGMENT_H_ |
8 #define _JBIG2_SEGMENT_H_ | 8 #define _JBIG2_SEGMENT_H_ |
9 #include "JBig2_Define.h" | 9 #include "JBig2_Define.h" |
10 #include "JBig2_SymbolDict.h" | 10 #include "JBig2_SymbolDict.h" |
11 #include "JBig2_PatternDict.h" | 11 #include "JBig2_PatternDict.h" |
12 #include "JBig2_Module.h" | 12 #include "JBig2_Module.h" |
13 #include "JBig2_HuffmanTable.h" | 13 #include "JBig2_HuffmanTable.h" |
14 #define JBIG2_GET_INT32(buf) (((buf)[0]<<24) | ((buf)[1]<<16) | ((buf)[2]<<8) |
(buf)[3]) | 14 #define JBIG2_GET_INT32(buf) \ |
15 #define JBIG2_GET_INT16(buf) (((buf)[0]<<8) | (buf)[1]) | 15 (((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3]) |
| 16 #define JBIG2_GET_INT16(buf) (((buf)[0] << 8) | (buf)[1]) |
16 typedef enum { | 17 typedef enum { |
17 JBIG2_SEGMENT_HEADER_UNPARSED, | 18 JBIG2_SEGMENT_HEADER_UNPARSED, |
18 JBIG2_SEGMENT_DATA_UNPARSED, | 19 JBIG2_SEGMENT_DATA_UNPARSED, |
19 JBIG2_SEGMENT_PARSE_COMPLETE, | 20 JBIG2_SEGMENT_PARSE_COMPLETE, |
20 JBIG2_SEGMENT_PAUSED, | 21 JBIG2_SEGMENT_PAUSED, |
21 JBIG2_SEGMENT_ERROR | 22 JBIG2_SEGMENT_ERROR |
22 } JBig2_SegmentState; | 23 } JBig2_SegmentState; |
23 typedef enum { | 24 typedef enum { |
24 JBIG2_VOID_POINTER» = 0, | 25 JBIG2_VOID_POINTER = 0, |
25 JBIG2_IMAGE_POINTER, | 26 JBIG2_IMAGE_POINTER, |
26 JBIG2_SYMBOL_DICT_POINTER, | 27 JBIG2_SYMBOL_DICT_POINTER, |
27 JBIG2_PATTERN_DICT_POINTER, | 28 JBIG2_PATTERN_DICT_POINTER, |
28 JBIG2_HUFFMAN_TABLE_POINTER | 29 JBIG2_HUFFMAN_TABLE_POINTER |
29 } JBig2_ResultType; | 30 } JBig2_ResultType; |
30 class CJBig2_Segment : public CJBig2_Object | 31 class CJBig2_Segment : public CJBig2_Object { |
31 { | 32 public: |
32 public: | 33 CJBig2_Segment(); |
33 | 34 |
34 CJBig2_Segment(); | 35 ~CJBig2_Segment(); |
35 | 36 |
36 ~CJBig2_Segment(); | 37 void init(); |
37 | 38 |
38 void init(); | 39 void clean(); |
39 | 40 |
40 void clean(); | 41 public: |
41 public: | 42 FX_DWORD m_dwNumber; |
42 FX_DWORD m_dwNumber; | 43 union { |
43 union { | 44 struct { |
44 struct { | 45 uint8_t type : 6; |
45 uint8_t type» » » » » :» 6; | 46 uint8_t page_association_size : 1; |
46 uint8_t page_association_size» :» 1; | 47 uint8_t deferred_non_retain : 1; |
47 uint8_t deferred_non_retain»» :» 1; | 48 } s; |
48 } s; | 49 uint8_t c; |
49 uint8_t c; | 50 } m_cFlags; |
50 } m_cFlags; | 51 int32_t m_nReferred_to_segment_count; |
51 int32_t m_nReferred_to_segment_count; | 52 FX_DWORD* m_pReferred_to_segment_numbers; |
52 FX_DWORD * m_pReferred_to_segment_numbers; | 53 FX_DWORD m_dwPage_association; |
53 FX_DWORD m_dwPage_association; | 54 FX_DWORD m_dwData_length; |
54 FX_DWORD m_dwData_length; | |
55 | 55 |
56 FX_DWORD m_dwHeader_Length; | 56 FX_DWORD m_dwHeader_Length; |
57 uint8_t *m_pData; | 57 uint8_t* m_pData; |
58 JBig2_SegmentState m_State; | 58 JBig2_SegmentState m_State; |
59 JBig2_ResultType m_nResultType; | 59 JBig2_ResultType m_nResultType; |
60 union { | 60 union { |
61 CJBig2_SymbolDict» *sd; | 61 CJBig2_SymbolDict* sd; |
62 CJBig2_PatternDict» *pd; | 62 CJBig2_PatternDict* pd; |
63 CJBig2_Image» » *im; | 63 CJBig2_Image* im; |
64 CJBig2_HuffmanTable» *ht; | 64 CJBig2_HuffmanTable* ht; |
65 void*» » » vd; | 65 void* vd; |
66 } m_Result; | 66 } m_Result; |
67 }; | 67 }; |
68 #endif | 68 #endif |
OLD | NEW |