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 #include <setjmp.h> | 7 #include <setjmp.h> |
8 | 8 |
9 #include "../../../include/fxcrt/fx_basic.h" | 9 #include "../../../include/fxcrt/fx_basic.h" |
10 | 10 |
11 extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p); | 11 extern FX_WORD _GetWord_LSBFirst(FX_LPBYTE p); |
12 extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v); | 12 extern void _SetWord_LSBFirst(FX_LPBYTE p, FX_WORD v); |
13 extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_INT32 src_bpc,
FX_INT32 dst_bpc, | 13 extern void _BpcConvert(FX_LPCBYTE src_buf, FX_DWORD src_len, int32_t src_bpc, i
nt32_t dst_bpc, |
14 FX_LPBYTE& dst_buf, FX_DWORD& dst_len); | 14 FX_LPBYTE& dst_buf, FX_DWORD& dst_len); |
15 #define GIF_SUPPORT_COMMENT_EXTENSION | 15 #define GIF_SUPPORT_COMMENT_EXTENSION |
16 #define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION | 16 #define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION |
17 #define GIF_SUPPORT_PLAIN_TEXT_EXTENSION | 17 #define GIF_SUPPORT_PLAIN_TEXT_EXTENSION |
18 #define GIF_SIGNATURE "GIF" | 18 #define GIF_SIGNATURE "GIF" |
19 #define GIF_SIG_EXTENSION 0x21 | 19 #define GIF_SIG_EXTENSION 0x21 |
20 #define GIF_SIG_IMAGE 0x2C | 20 #define GIF_SIG_IMAGE 0x2C |
21 #define GIF_SIG_TRAILER 0x3B | 21 #define GIF_SIG_TRAILER 0x3B |
22 #define GIF_BLOCK_GCE 0xF9 | 22 #define GIF_BLOCK_GCE 0xF9 |
23 #define GIF_BLOCK_PTE 0x01 | 23 #define GIF_BLOCK_PTE 0x01 |
24 #define GIF_BLOCK_CE 0xFE | 24 #define GIF_BLOCK_CE 0xFE |
25 #define GIF_BLOCK_AE 0xFF | 25 #define GIF_BLOCK_AE 0xFF |
26 #define GIF_BLOCK_TERMINAL 0x00 | 26 #define GIF_BLOCK_TERMINAL 0x00 |
27 #define GIF_MAX_LZW_CODE 4096 | 27 #define GIF_MAX_LZW_CODE 4096 |
28 #define GIF_DATA_BLOCK 255 | 28 #define GIF_DATA_BLOCK 255 |
29 #define GIF_MAX_ERROR_SIZE 256 | 29 #define GIF_MAX_ERROR_SIZE 256 |
30 #define GIF_D_STATUS_SIG 0x01 | 30 #define GIF_D_STATUS_SIG 0x01 |
31 #define GIF_D_STATUS_TAIL 0x02 | 31 #define GIF_D_STATUS_TAIL 0x02 |
32 #define GIF_D_STATUS_EXT 0x03 | 32 #define GIF_D_STATUS_EXT 0x03 |
33 #define GIF_D_STATUS_EXT_AE 0x04 | 33 #define GIF_D_STATUS_EXT_AE 0x04 |
34 #define GIF_D_STATUS_EXT_CE 0x05 | 34 #define GIF_D_STATUS_EXT_CE 0x05 |
35 #define GIF_D_STATUS_EXT_GCE 0x06 | 35 #define GIF_D_STATUS_EXT_GCE 0x06 |
36 #define GIF_D_STATUS_EXT_PTE 0x07 | 36 #define GIF_D_STATUS_EXT_PTE 0x07 |
37 #define GIF_D_STATUS_EXT_UNE 0x08 | 37 #define GIF_D_STATUS_EXT_UNE 0x08 |
38 #define GIF_D_STATUS_IMG_INFO 0x09 | 38 #define GIF_D_STATUS_IMG_INFO 0x09 |
39 #define GIF_D_STATUS_IMG_DATA 0x0A | 39 #define GIF_D_STATUS_IMG_DATA 0x0A |
40 #pragma pack(1) | 40 #pragma pack(1) |
41 typedef struct tagGifGF { | 41 typedef struct tagGifGF { |
42 FX_BYTE pal_bits : 3; | 42 uint8_t pal_bits : 3; |
43 FX_BYTE sort_flag : 1; | 43 uint8_t sort_flag : 1; |
44 FX_BYTE color_resolution : 3; | 44 uint8_t color_resolution : 3; |
45 FX_BYTE global_pal : 1; | 45 uint8_t global_pal : 1; |
46 } GifGF; | 46 } GifGF; |
47 typedef struct tagGifLF { | 47 typedef struct tagGifLF { |
48 FX_BYTE pal_bits : 3; | 48 uint8_t pal_bits : 3; |
49 FX_BYTE reserved : 2; | 49 uint8_t reserved : 2; |
50 FX_BYTE sort_flag : 1; | 50 uint8_t sort_flag : 1; |
51 FX_BYTE interlace : 1; | 51 uint8_t interlace : 1; |
52 FX_BYTE local_pal : 1; | 52 uint8_t local_pal : 1; |
53 } GifLF; | 53 } GifLF; |
54 typedef struct tagGifHeader { | 54 typedef struct tagGifHeader { |
55 char signature[3]; | 55 char signature[3]; |
56 char version[3]; | 56 char version[3]; |
57 } GifHeader; | 57 } GifHeader; |
58 typedef struct tagGifLSD { | 58 typedef struct tagGifLSD { |
59 FX_WORD width; | 59 FX_WORD width; |
60 FX_WORD height; | 60 FX_WORD height; |
61 FX_BYTE» global_flag; | 61 uint8_t» global_flag; |
62 FX_BYTE bc_index; | 62 uint8_t bc_index; |
63 FX_BYTE» pixel_aspect; | 63 uint8_t» pixel_aspect; |
64 } GifLSD; | 64 } GifLSD; |
65 typedef struct tagGifImageInfo { | 65 typedef struct tagGifImageInfo { |
66 FX_WORD left; | 66 FX_WORD left; |
67 FX_WORD top; | 67 FX_WORD top; |
68 FX_WORD width; | 68 FX_WORD width; |
69 FX_WORD height; | 69 FX_WORD height; |
70 | 70 |
71 FX_BYTE» local_flag; | 71 uint8_t» local_flag; |
72 } GifImageInfo; | 72 } GifImageInfo; |
73 typedef struct tagGifCEF { | 73 typedef struct tagGifCEF { |
74 FX_BYTE transparency : 1; | 74 uint8_t transparency : 1; |
75 FX_BYTE user_input : 1; | 75 uint8_t user_input : 1; |
76 FX_BYTE disposal_method : 3; | 76 uint8_t disposal_method : 3; |
77 FX_BYTE reserved : 3; | 77 uint8_t reserved : 3; |
78 } GifCEF; | 78 } GifCEF; |
79 typedef struct tagGifGCE { | 79 typedef struct tagGifGCE { |
80 FX_BYTE block_size; | 80 uint8_t block_size; |
81 FX_BYTE» gce_flag; | 81 uint8_t» gce_flag; |
82 FX_WORD delay_time; | 82 FX_WORD delay_time; |
83 FX_BYTE» trans_index; | 83 uint8_t» trans_index; |
84 } GifGCE; | 84 } GifGCE; |
85 typedef struct tagGifPTE { | 85 typedef struct tagGifPTE { |
86 FX_BYTE block_size; | 86 uint8_t block_size; |
87 FX_WORD grid_left; | 87 FX_WORD grid_left; |
88 FX_WORD grid_top; | 88 FX_WORD grid_top; |
89 FX_WORD grid_width; | 89 FX_WORD grid_width; |
90 FX_WORD grid_height; | 90 FX_WORD grid_height; |
91 | 91 |
92 FX_BYTE char_width; | 92 uint8_t char_width; |
93 FX_BYTE char_height; | 93 uint8_t char_height; |
94 | 94 |
95 FX_BYTE fc_index; | 95 uint8_t fc_index; |
96 FX_BYTE bc_index; | 96 uint8_t bc_index; |
97 } GifPTE; | 97 } GifPTE; |
98 typedef struct tagGifAE { | 98 typedef struct tagGifAE { |
99 FX_BYTE block_size; | 99 uint8_t block_size; |
100 FX_BYTE app_identify[8]; | 100 uint8_t app_identify[8]; |
101 FX_BYTE» app_authentication[3]; | 101 uint8_t» app_authentication[3]; |
102 } GifAE; | 102 } GifAE; |
103 typedef struct tagGifPalette { | 103 typedef struct tagGifPalette { |
104 FX_BYTE r, g, b; | 104 uint8_t r, g, b; |
105 } GifPalette; | 105 } GifPalette; |
106 #pragma pack() | 106 #pragma pack() |
107 typedef struct tagGifImage { | 107 typedef struct tagGifImage { |
108 GifGCE* image_gce_ptr; | 108 GifGCE* image_gce_ptr; |
109 GifPalette* local_pal_ptr; | 109 GifPalette* local_pal_ptr; |
110 GifImageInfo* image_info_ptr; | 110 GifImageInfo* image_info_ptr; |
111 FX_BYTE» » » image_code_size; | 111 uint8_t» » » image_code_size; |
112 FX_DWORD image_data_pos; | 112 FX_DWORD image_data_pos; |
113 FX_LPBYTE image_row_buf; | 113 FX_LPBYTE image_row_buf; |
114 FX_INT32» » image_row_num; | 114 int32_t» » image_row_num; |
115 } GifImage; | 115 } GifImage; |
116 typedef struct tagGifPlainText { | 116 typedef struct tagGifPlainText { |
117 GifGCE* gce_ptr; | 117 GifGCE* gce_ptr; |
118 GifPTE* pte_ptr; | 118 GifPTE* pte_ptr; |
119 CFX_ByteString* string_ptr; | 119 CFX_ByteString* string_ptr; |
120 } GifPlainText; | 120 } GifPlainText; |
121 class CGifLZWDecoder | 121 class CGifLZWDecoder |
122 { | 122 { |
123 public: | 123 public: |
124 struct tag_Table { | 124 struct tag_Table { |
125 FX_WORD prefix; | 125 FX_WORD prefix; |
126 FX_BYTE suffix; | 126 uint8_t suffix; |
127 }; | 127 }; |
128 CGifLZWDecoder(FX_LPSTR error_ptr = NULL) | 128 CGifLZWDecoder(FX_LPSTR error_ptr = NULL) |
129 { | 129 { |
130 err_msg_ptr = error_ptr; | 130 err_msg_ptr = error_ptr; |
131 } | 131 } |
132 void» » InitTable(FX_BYTE code_len); | 132 void» » InitTable(uint8_t code_len); |
133 | 133 |
134 FX_INT32» Decode(FX_LPBYTE des_buf, FX_DWORD& des_size); | 134 int32_t» Decode(FX_LPBYTE des_buf, FX_DWORD& des_size); |
135 | 135 |
136 void Input(FX_LPBYTE src_buf, FX_DWORD src_size); | 136 void Input(FX_LPBYTE src_buf, FX_DWORD src_size); |
137 FX_DWORD GetAvailInput(); | 137 FX_DWORD GetAvailInput(); |
138 | 138 |
139 private: | 139 private: |
140 void ClearTable(); | 140 void ClearTable(); |
141 void» » AddCode(FX_WORD prefix_code, FX_BYTE append_char); | 141 void» » AddCode(FX_WORD prefix_code, uint8_t append_char); |
142 void DecodeString(FX_WORD code); | 142 void DecodeString(FX_WORD code); |
143 FX_BYTE» » code_size; | 143 uint8_t» » code_size; |
144 FX_BYTE» » code_size_cur; | 144 uint8_t» » code_size_cur; |
145 FX_WORD code_clear; | 145 FX_WORD code_clear; |
146 FX_WORD code_end; | 146 FX_WORD code_end; |
147 FX_WORD code_next; | 147 FX_WORD code_next; |
148 FX_BYTE» » code_first; | 148 uint8_t» » code_first; |
149 FX_BYTE» » stack[GIF_MAX_LZW_CODE]; | 149 uint8_t» » stack[GIF_MAX_LZW_CODE]; |
150 FX_WORD stack_size; | 150 FX_WORD stack_size; |
151 tag_Table code_table[GIF_MAX_LZW_CODE]; | 151 tag_Table code_table[GIF_MAX_LZW_CODE]; |
152 FX_WORD code_old; | 152 FX_WORD code_old; |
153 | 153 |
154 FX_LPBYTE next_in; | 154 FX_LPBYTE next_in; |
155 FX_DWORD avail_in; | 155 FX_DWORD avail_in; |
156 | 156 |
157 FX_BYTE» » bits_left; | 157 uint8_t» » bits_left; |
158 FX_DWORD code_store; | 158 FX_DWORD code_store; |
159 | 159 |
160 FX_LPSTR err_msg_ptr; | 160 FX_LPSTR err_msg_ptr; |
161 }; | 161 }; |
162 class CGifLZWEncoder | 162 class CGifLZWEncoder |
163 { | 163 { |
164 public: | 164 public: |
165 struct tag_Table { | 165 struct tag_Table { |
166 FX_WORD prefix; | 166 FX_WORD prefix; |
167 FX_BYTE»» suffix; | 167 uint8_t»» suffix; |
168 }; | 168 }; |
169 CGifLZWEncoder(); | 169 CGifLZWEncoder(); |
170 ~CGifLZWEncoder(); | 170 ~CGifLZWEncoder(); |
171 void» » Start(FX_BYTE code_len, FX_LPCBYTE src_buf, FX_LPBYTE& d
st_buf, FX_DWORD& offset); | 171 void» » Start(uint8_t code_len, FX_LPCBYTE src_buf, FX_LPBYTE& d
st_buf, FX_DWORD& offset); |
172 FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE&
dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); | 172 FX_BOOL Encode(FX_LPCBYTE src_buf, FX_DWORD src_len, FX_LPBYTE&
dst_buf, FX_DWORD& dst_len, FX_DWORD& offset); |
173 void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD&
offset); | 173 void Finish(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWORD&
offset); |
174 private: | 174 private: |
175 void ClearTable(); | 175 void ClearTable(); |
176 FX_BOOL» » LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, FX_BYTE&
bit_offset); | 176 FX_BOOL» » LookUpInTable(FX_LPCBYTE buf, FX_DWORD& offset, uint8_t&
bit_offset); |
177 void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWOR
D& dst_len, FX_DWORD& offset); | 177 void EncodeString(FX_DWORD index, FX_LPBYTE& dst_buf, FX_DWOR
D& dst_len, FX_DWORD& offset); |
178 void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWO
RD& offset); | 178 void WriteBlock(FX_LPBYTE& dst_buf, FX_DWORD& dst_len, FX_DWO
RD& offset); |
179 jmp_buf jmp; | 179 jmp_buf jmp; |
180 FX_DWORD src_offset; | 180 FX_DWORD src_offset; |
181 FX_BYTE» » src_bit_offset; | 181 uint8_t» » src_bit_offset; |
182 FX_BYTE» » src_bit_cut; | 182 uint8_t» » src_bit_cut; |
183 FX_DWORD src_bit_num; | 183 FX_DWORD src_bit_num; |
184 FX_BYTE» » code_size; | 184 uint8_t» » code_size; |
185 FX_WORD code_clear; | 185 FX_WORD code_clear; |
186 FX_WORD code_end; | 186 FX_WORD code_end; |
187 FX_WORD index_num; | 187 FX_WORD index_num; |
188 FX_BYTE» » bit_offset; | 188 uint8_t» » bit_offset; |
189 FX_BYTE» » index_bit_cur; | 189 uint8_t» » index_bit_cur; |
190 FX_BYTE» » index_buf[GIF_DATA_BLOCK]; | 190 uint8_t» » index_buf[GIF_DATA_BLOCK]; |
191 FX_BYTE» » index_buf_len; | 191 uint8_t» » index_buf_len; |
192 tag_Table code_table[GIF_MAX_LZW_CODE]; | 192 tag_Table code_table[GIF_MAX_LZW_CODE]; |
193 FX_WORD table_cur; | 193 FX_WORD table_cur; |
194 }; | 194 }; |
195 typedef struct tag_gif_decompress_struct gif_decompress_struct; | 195 typedef struct tag_gif_decompress_struct gif_decompress_struct; |
196 typedef gif_decompress_struct *gif_decompress_struct_p; | 196 typedef gif_decompress_struct *gif_decompress_struct_p; |
197 typedef gif_decompress_struct_p *gif_decompress_struct_pp; | 197 typedef gif_decompress_struct_p *gif_decompress_struct_pp; |
198 static FX_INT32 s_gif_interlace_step[4] = {8, 8, 4, 2}; | 198 static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2}; |
199 struct tag_gif_decompress_struct { | 199 struct tag_gif_decompress_struct { |
200 jmp_buf jmpbuf; | 200 jmp_buf jmpbuf; |
201 FX_LPSTR err_ptr; | 201 FX_LPSTR err_ptr; |
202 void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr
, FX_LPCSTR err_msg); | 202 void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr
, FX_LPCSTR err_msg); |
203 void* context_ptr; | 203 void* context_ptr; |
204 int width; | 204 int width; |
205 int height; | 205 int height; |
206 GifPalette* global_pal_ptr; | 206 GifPalette* global_pal_ptr; |
207 FX_INT32» » global_pal_num; | 207 int32_t» » global_pal_num; |
208 FX_BYTE» » » global_sort_flag; | 208 uint8_t» » » global_sort_flag; |
209 FX_BYTE» » » global_color_resolution; | 209 uint8_t» » » global_color_resolution; |
210 | 210 |
211 FX_BYTE» » » bc_index; | 211 uint8_t» » » bc_index; |
212 FX_BYTE» » » pixel_aspect; | 212 uint8_t» » » pixel_aspect; |
213 CGifLZWDecoder* img_decoder_ptr; | 213 CGifLZWDecoder* img_decoder_ptr; |
214 FX_DWORD img_row_offset; | 214 FX_DWORD img_row_offset; |
215 FX_DWORD img_row_avail_size; | 215 FX_DWORD img_row_avail_size; |
216 FX_BYTE» » » img_pass_num; | 216 uint8_t» » » img_pass_num; |
217 CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr; | 217 CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr; |
218 FX_LPBYTE» » (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_p
tr, FX_INT32 pal_size); | 218 FX_LPBYTE» » (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_p
tr, int32_t pal_size); |
219 FX_LPBYTE next_in; | 219 FX_LPBYTE next_in; |
220 FX_DWORD avail_in; | 220 FX_DWORD avail_in; |
221 FX_INT32» » decode_status; | 221 int32_t» » decode_status; |
222 FX_DWORD skip_size; | 222 FX_DWORD skip_size; |
223 void (*_gif_record_current_position_fn)(gif_decompres
s_struct_p gif_ptr, FX_DWORD* cur_pos_ptr); | 223 void (*_gif_record_current_position_fn)(gif_decompres
s_struct_p gif_ptr, FX_DWORD* cur_pos_ptr); |
224 void» » » (*_gif_get_row_fn)(gif_decompress_struct_p gif_p
tr, FX_INT32 row_num, FX_LPBYTE row_buf); | 224 void» » » (*_gif_get_row_fn)(gif_decompress_struct_p gif_p
tr, int32_t row_num, FX_LPBYTE row_buf); |
225 FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_st
ruct_p gif_ptr, FX_DWORD cur_pos, | 225 FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_st
ruct_p gif_ptr, FX_DWORD cur_pos, |
226 FX_INT32 left, FX_INT32 top, FX_INT32 width, FX_INT32 height, | 226 int32_t left, int32_t top, int32_t width, int32_t height, |
227 FX_INT32 pal_num, void* pal_ptr, | 227 int32_t pal_num, void* pal_ptr, |
228 FX_INT32 delay_time, FX_BOOL user_input, | 228 int32_t delay_time, FX_BOOL user_input, |
229 FX_INT32 trans_index, FX_INT32 disposal_method, FX_BOOL interlace); | 229 int32_t trans_index, int32_t disposal_method, FX_BOOL interlace); |
230 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION | 230 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION |
231 FX_BYTE» » » app_identify[8]; | 231 uint8_t» » » app_identify[8]; |
232 FX_BYTE» » » app_authentication[3]; | 232 uint8_t» » » app_authentication[3]; |
233 FX_DWORD app_data_size; | 233 FX_DWORD app_data_size; |
234 FX_LPBYTE app_data; | 234 FX_LPBYTE app_data; |
235 #endif | 235 #endif |
236 #ifdef GIF_SUPPORT_COMMENT_EXTENSION | 236 #ifdef GIF_SUPPORT_COMMENT_EXTENSION |
237 CFX_ByteString* cmt_data_ptr; | 237 CFX_ByteString* cmt_data_ptr; |
238 #endif | 238 #endif |
239 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION | 239 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION |
240 GifGCE* gce_ptr; | 240 GifGCE* gce_ptr; |
241 #endif | 241 #endif |
242 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION | 242 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION |
(...skipping 12 matching lines...) Expand all Loading... |
255 FX_DWORD frames; | 255 FX_DWORD frames; |
256 GifHeader* header_ptr; | 256 GifHeader* header_ptr; |
257 GifLSD* lsd_ptr; | 257 GifLSD* lsd_ptr; |
258 GifPalette* global_pal; | 258 GifPalette* global_pal; |
259 FX_WORD gpal_num; | 259 FX_WORD gpal_num; |
260 GifPalette* local_pal; | 260 GifPalette* local_pal; |
261 FX_WORD lpal_num; | 261 FX_WORD lpal_num; |
262 GifImageInfo* image_info_ptr; | 262 GifImageInfo* image_info_ptr; |
263 CGifLZWEncoder* img_encoder_ptr; | 263 CGifLZWEncoder* img_encoder_ptr; |
264 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION | 264 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION |
265 FX_BYTE» » » app_identify[8]; | 265 uint8_t» » » app_identify[8]; |
266 FX_BYTE» » » app_authentication[3]; | 266 uint8_t» » » app_authentication[3]; |
267 FX_DWORD app_data_size; | 267 FX_DWORD app_data_size; |
268 FX_LPBYTE app_data; | 268 FX_LPBYTE app_data; |
269 #endif | 269 #endif |
270 | 270 |
271 #ifdef GIF_SUPPORT_COMMENT_EXTENSION | 271 #ifdef GIF_SUPPORT_COMMENT_EXTENSION |
272 FX_LPBYTE cmt_data_ptr; | 272 FX_LPBYTE cmt_data_ptr; |
273 FX_DWORD cmt_data_len; | 273 FX_DWORD cmt_data_len; |
274 #endif | 274 #endif |
275 | 275 |
276 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION | 276 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION |
277 GifGCE* gce_ptr; | 277 GifGCE* gce_ptr; |
278 #endif | 278 #endif |
279 | 279 |
280 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION | 280 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION |
281 GifPTE* pte_ptr; | 281 GifPTE* pte_ptr; |
282 FX_LPCBYTE pte_data_ptr; | 282 FX_LPCBYTE pte_data_ptr; |
283 FX_DWORD pte_data_len; | 283 FX_DWORD pte_data_len; |
284 #endif | 284 #endif |
285 }; | 285 }; |
286 void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg); | 286 void _gif_error(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg); |
287 void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg); | 287 void _gif_warn(gif_decompress_struct_p gif_ptr, FX_LPCSTR err_msg); |
288 gif_decompress_struct_p _gif_create_decompress(); | 288 gif_decompress_struct_p _gif_create_decompress(); |
289 void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr); | 289 void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr); |
290 gif_compress_struct_p _gif_create_compress(); | 290 gif_compress_struct_p _gif_create_compress(); |
291 void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr); | 291 void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr); |
292 FX_INT32 _gif_read_header(gif_decompress_struct_p gif_ptr); | 292 int32_t _gif_read_header(gif_decompress_struct_p gif_ptr); |
293 FX_INT32 _gif_get_frame(gif_decompress_struct_p gif_ptr); | 293 int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr); |
294 FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr); | 294 int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr); |
295 FX_INT32 _gif_decode_extension(gif_decompress_struct_p gif_ptr); | 295 int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr); |
296 FX_INT32 _gif_decode_image_info(gif_decompress_struct_p gif_ptr); | 296 int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr); |
297 void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr
); | 297 void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, GifGCE** gce_ptr_ptr
); |
298 FX_INT32 _gif_load_frame(gif_decompress_struct_p gif_ptr, FX_INT32 frame_num); | 298 int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num); |
299 FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp,
FX_DWORD data_size); | 299 FX_LPBYTE _gif_read_data(gif_decompress_struct_p gif_ptr, FX_LPBYTE* des_buf_pp,
FX_DWORD data_size); |
300 void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, FX_INT32 status)
; | 300 void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); |
301 void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DW
ORD src_size); | 301 void _gif_input_buffer(gif_decompress_struct_p gif_ptr, FX_LPBYTE src_buf, FX_DW
ORD src_size); |
302 FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_
buf_ptr); | 302 FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, FX_LPBYTE* avial_
buf_ptr); |
303 void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height); | 303 void interlace_buf(FX_LPCBYTE buf, FX_DWORD width, FX_DWORD height); |
304 FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD
& dst_len ); | 304 FX_BOOL _gif_encode( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_buf, FX_DWORD
& dst_len ); |
305 #define GIF_PTR_NOT_NULL(ptr,gif_ptr) if(ptr == NULL){
\ | 305 #define GIF_PTR_NOT_NULL(ptr,gif_ptr) if(ptr == NULL){
\ |
306 _gif_error(gif_ptr,"Out Of Memory");\ | 306 _gif_error(gif_ptr,"Out Of Memory");\ |
307 return 0; \ | 307 return 0; \ |
308 } | 308 } |
OLD | NEW |