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 CORE_FXCODEC_LGIF_FX_GIF_H_ | 7 #ifndef CORE_FXCODEC_LGIF_FX_GIF_H_ |
8 #define CORE_FXCODEC_LGIF_FX_GIF_H_ | 8 #define CORE_FXCODEC_LGIF_FX_GIF_H_ |
9 | 9 |
10 #include <setjmp.h> | 10 #include <setjmp.h> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 uint8_t suffix; | 161 uint8_t suffix; |
162 }; | 162 }; |
163 | 163 |
164 CGifLZWEncoder(); | 164 CGifLZWEncoder(); |
165 ~CGifLZWEncoder(); | 165 ~CGifLZWEncoder(); |
166 | 166 |
167 void Start(uint8_t code_len, | 167 void Start(uint8_t code_len, |
168 const uint8_t* src_buf, | 168 const uint8_t* src_buf, |
169 uint8_t*& dst_buf, | 169 uint8_t*& dst_buf, |
170 uint32_t& offset); | 170 uint32_t& offset); |
171 FX_BOOL Encode(const uint8_t* src_buf, | 171 bool Encode(const uint8_t* src_buf, |
172 uint32_t src_len, | 172 uint32_t src_len, |
173 uint8_t*& dst_buf, | 173 uint8_t*& dst_buf, |
174 uint32_t& dst_len, | 174 uint32_t& dst_len, |
175 uint32_t& offset); | 175 uint32_t& offset); |
176 void Finish(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); | 176 void Finish(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); |
177 | 177 |
178 private: | 178 private: |
179 void ClearTable(); | 179 void ClearTable(); |
180 FX_BOOL LookUpInTable(const uint8_t* buf, | 180 bool LookUpInTable(const uint8_t* buf, uint32_t& offset, uint8_t& bit_offset); |
181 uint32_t& offset, | |
182 uint8_t& bit_offset); | |
183 void EncodeString(uint32_t index, | 181 void EncodeString(uint32_t index, |
184 uint8_t*& dst_buf, | 182 uint8_t*& dst_buf, |
185 uint32_t& dst_len, | 183 uint32_t& dst_len, |
186 uint32_t& offset); | 184 uint32_t& offset); |
187 void WriteBlock(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); | 185 void WriteBlock(uint8_t*& dst_buf, uint32_t& dst_len, uint32_t& offset); |
188 | 186 |
189 jmp_buf jmp; | 187 jmp_buf jmp; |
190 uint32_t src_offset; | 188 uint32_t src_offset; |
191 uint8_t src_bit_offset; | 189 uint8_t src_bit_offset; |
192 uint8_t src_bit_cut; | 190 uint8_t src_bit_cut; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 int32_t pal_size); | 228 int32_t pal_size); |
231 uint8_t* next_in; | 229 uint8_t* next_in; |
232 uint32_t avail_in; | 230 uint32_t avail_in; |
233 int32_t decode_status; | 231 int32_t decode_status; |
234 uint32_t skip_size; | 232 uint32_t skip_size; |
235 void (*gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, | 233 void (*gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, |
236 uint32_t* cur_pos_ptr); | 234 uint32_t* cur_pos_ptr); |
237 void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr, | 235 void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr, |
238 int32_t row_num, | 236 int32_t row_num, |
239 uint8_t* row_buf); | 237 uint8_t* row_buf); |
240 FX_BOOL (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, | 238 bool (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, |
241 uint32_t cur_pos, | 239 uint32_t cur_pos, |
242 int32_t left, int32_t top, int32_t width, int32_t height, | 240 int32_t left, |
243 int32_t pal_num, void* pal_ptr, | 241 int32_t top, |
244 int32_t delay_time, FX_BOOL user_input, | 242 int32_t width, |
245 int32_t trans_index, int32_t disposal_method, FX_BOOL interlace); | 243 int32_t height, |
| 244 int32_t pal_num, |
| 245 void* pal_ptr, |
| 246 int32_t delay_time, |
| 247 bool user_input, |
| 248 int32_t trans_index, |
| 249 int32_t disposal_method, |
| 250 bool interlace); |
246 CFX_ByteString* cmt_data_ptr; | 251 CFX_ByteString* cmt_data_ptr; |
247 GifGCE* gce_ptr; | 252 GifGCE* gce_ptr; |
248 CFX_ArrayTemplate<GifPlainText*>* pt_ptr_arr_ptr; | 253 CFX_ArrayTemplate<GifPlainText*>* pt_ptr_arr_ptr; |
249 }; | 254 }; |
250 typedef struct tag_gif_compress_struct gif_compress_struct; | 255 typedef struct tag_gif_compress_struct gif_compress_struct; |
251 typedef gif_compress_struct* gif_compress_struct_p; | 256 typedef gif_compress_struct* gif_compress_struct_p; |
252 typedef gif_compress_struct_p* gif_compress_struct_pp; | 257 typedef gif_compress_struct_p* gif_compress_struct_pp; |
253 struct tag_gif_compress_struct { | 258 struct tag_gif_compress_struct { |
254 const uint8_t* src_buf; | 259 const uint8_t* src_buf; |
255 uint32_t src_pitch; | 260 uint32_t src_pitch; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 uint32_t data_size); | 298 uint32_t data_size); |
294 void gif_decoding_failure_at_tail_cleanup(gif_decompress_struct_p gif_ptr, | 299 void gif_decoding_failure_at_tail_cleanup(gif_decompress_struct_p gif_ptr, |
295 GifImage* gif_image_ptr); | 300 GifImage* gif_image_ptr); |
296 void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); | 301 void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); |
297 void gif_input_buffer(gif_decompress_struct_p gif_ptr, | 302 void gif_input_buffer(gif_decompress_struct_p gif_ptr, |
298 uint8_t* src_buf, | 303 uint8_t* src_buf, |
299 uint32_t src_size); | 304 uint32_t src_size); |
300 uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, | 305 uint32_t gif_get_avail_input(gif_decompress_struct_p gif_ptr, |
301 uint8_t** avail_buf_ptr); | 306 uint8_t** avail_buf_ptr); |
302 void interlace_buf(const uint8_t* buf, uint32_t width, uint32_t height); | 307 void interlace_buf(const uint8_t* buf, uint32_t width, uint32_t height); |
303 FX_BOOL gif_encode(gif_compress_struct_p gif_ptr, | 308 bool gif_encode(gif_compress_struct_p gif_ptr, |
304 uint8_t*& dst_buf, | 309 uint8_t*& dst_buf, |
305 uint32_t& dst_len); | 310 uint32_t& dst_len); |
306 | 311 |
307 #endif // CORE_FXCODEC_LGIF_FX_GIF_H_ | 312 #endif // CORE_FXCODEC_LGIF_FX_GIF_H_ |
OLD | NEW |