Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: core/src/fxcodec/lgif/fx_gif.h

Issue 1739623002: Rename some functions that start with underscore. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.cpp ('k') | core/src/fxcodec/lgif/fx_gif.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SRC_FXCODEC_LGIF_FX_GIF_H_ 7 #ifndef CORE_SRC_FXCODEC_LGIF_FX_GIF_H_
8 #define CORE_SRC_FXCODEC_LGIF_FX_GIF_H_ 8 #define CORE_SRC_FXCODEC_LGIF_FX_GIF_H_
9 9
10 #include <setjmp.h> 10 #include <setjmp.h>
11 11
12 #include "core/include/fxcrt/fx_basic.h" 12 #include "core/include/fxcrt/fx_basic.h"
13 13
14 extern FX_WORD _GetWord_LSBFirst(uint8_t* p);
15 extern void _SetWord_LSBFirst(uint8_t* p, FX_WORD v);
16 extern void _BpcConvert(const uint8_t* src_buf,
17 FX_DWORD src_len,
18 int32_t src_bpc,
19 int32_t dst_bpc,
20 uint8_t*& dst_buf,
21 FX_DWORD& dst_len);
22 #define GIF_SUPPORT_COMMENT_EXTENSION
23 #define GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
24 #define GIF_SUPPORT_PLAIN_TEXT_EXTENSION
25 #define GIF_SIGNATURE "GIF" 14 #define GIF_SIGNATURE "GIF"
26 #define GIF_SIG_EXTENSION 0x21 15 #define GIF_SIG_EXTENSION 0x21
27 #define GIF_SIG_IMAGE 0x2C 16 #define GIF_SIG_IMAGE 0x2C
28 #define GIF_SIG_TRAILER 0x3B 17 #define GIF_SIG_TRAILER 0x3B
29 #define GIF_BLOCK_GCE 0xF9 18 #define GIF_BLOCK_GCE 0xF9
30 #define GIF_BLOCK_PTE 0x01 19 #define GIF_BLOCK_PTE 0x01
31 #define GIF_BLOCK_CE 0xFE 20 #define GIF_BLOCK_CE 0xFE
32 #define GIF_BLOCK_AE 0xFF 21 #define GIF_BLOCK_AE 0xFF
33 #define GIF_BLOCK_TERMINAL 0x00 22 #define GIF_BLOCK_TERMINAL 0x00
34 #define GIF_MAX_LZW_CODE 4096 23 #define GIF_MAX_LZW_CODE 4096
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 uint8_t bit_offset; 190 uint8_t bit_offset;
202 uint8_t index_bit_cur; 191 uint8_t index_bit_cur;
203 uint8_t index_buf[GIF_DATA_BLOCK]; 192 uint8_t index_buf[GIF_DATA_BLOCK];
204 uint8_t index_buf_len; 193 uint8_t index_buf_len;
205 tag_Table code_table[GIF_MAX_LZW_CODE]; 194 tag_Table code_table[GIF_MAX_LZW_CODE];
206 FX_WORD table_cur; 195 FX_WORD table_cur;
207 }; 196 };
208 typedef struct tag_gif_decompress_struct gif_decompress_struct; 197 typedef struct tag_gif_decompress_struct gif_decompress_struct;
209 typedef gif_decompress_struct* gif_decompress_struct_p; 198 typedef gif_decompress_struct* gif_decompress_struct_p;
210 typedef gif_decompress_struct_p* gif_decompress_struct_pp; 199 typedef gif_decompress_struct_p* gif_decompress_struct_pp;
211 static int32_t s_gif_interlace_step[4] = {8, 8, 4, 2}; 200 static const int32_t s_gif_interlace_step[4] = {8, 8, 4, 2};
212 struct tag_gif_decompress_struct { 201 struct tag_gif_decompress_struct {
213 jmp_buf jmpbuf; 202 jmp_buf jmpbuf;
214 FX_CHAR* err_ptr; 203 FX_CHAR* err_ptr;
215 void (*_gif_error_fn)(gif_decompress_struct_p gif_ptr, 204 void (*gif_error_fn)(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
216 const FX_CHAR* err_msg);
217 void* context_ptr; 205 void* context_ptr;
218 int width; 206 int width;
219 int height; 207 int height;
220 GifPalette* global_pal_ptr; 208 GifPalette* global_pal_ptr;
221 int32_t global_pal_num; 209 int32_t global_pal_num;
222 uint8_t global_sort_flag; 210 uint8_t global_sort_flag;
223 uint8_t global_color_resolution; 211 uint8_t global_color_resolution;
224 212
225 uint8_t bc_index; 213 uint8_t bc_index;
226 uint8_t pixel_aspect; 214 uint8_t pixel_aspect;
227 CGifLZWDecoder* img_decoder_ptr; 215 CGifLZWDecoder* img_decoder_ptr;
228 FX_DWORD img_row_offset; 216 FX_DWORD img_row_offset;
229 FX_DWORD img_row_avail_size; 217 FX_DWORD img_row_avail_size;
230 uint8_t img_pass_num; 218 uint8_t img_pass_num;
231 CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr; 219 CFX_ArrayTemplate<GifImage*>* img_ptr_arr_ptr;
232 uint8_t* (*_gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr, 220 uint8_t* (*gif_ask_buf_for_pal_fn)(gif_decompress_struct_p gif_ptr,
233 int32_t pal_size); 221 int32_t pal_size);
234 uint8_t* next_in; 222 uint8_t* next_in;
235 FX_DWORD avail_in; 223 FX_DWORD avail_in;
236 int32_t decode_status; 224 int32_t decode_status;
237 FX_DWORD skip_size; 225 FX_DWORD skip_size;
238 void (*_gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr, 226 void (*gif_record_current_position_fn)(gif_decompress_struct_p gif_ptr,
239 FX_DWORD* cur_pos_ptr); 227 FX_DWORD* cur_pos_ptr);
240 void (*_gif_get_row_fn)(gif_decompress_struct_p gif_ptr, 228 void (*gif_get_row_fn)(gif_decompress_struct_p gif_ptr,
241 int32_t row_num, 229 int32_t row_num,
242 uint8_t* row_buf); 230 uint8_t* row_buf);
243 FX_BOOL (*_gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr, 231 FX_BOOL (*gif_get_record_position_fn)(gif_decompress_struct_p gif_ptr,
244 FX_DWORD cur_pos, 232 FX_DWORD cur_pos,
245 int32_t left, int32_t top, int32_t width, int32_t height, 233 int32_t left, int32_t top, int32_t width, int32_t height,
246 int32_t pal_num, void* pal_ptr, 234 int32_t pal_num, void* pal_ptr,
247 int32_t delay_time, FX_BOOL user_input, 235 int32_t delay_time, FX_BOOL user_input,
248 int32_t trans_index, int32_t disposal_method, FX_BOOL interlace); 236 int32_t trans_index, int32_t disposal_method, FX_BOOL interlace);
249 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION
250 uint8_t app_identify[8];
251 uint8_t app_authentication[3];
252 FX_DWORD app_data_size;
253 uint8_t* app_data;
254 #endif
255 #ifdef GIF_SUPPORT_COMMENT_EXTENSION
256 CFX_ByteString* cmt_data_ptr; 237 CFX_ByteString* cmt_data_ptr;
257 #endif
258 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
259 GifGCE* gce_ptr; 238 GifGCE* gce_ptr;
260 #endif
261 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
262 CFX_ArrayTemplate<GifPlainText*>* pt_ptr_arr_ptr; 239 CFX_ArrayTemplate<GifPlainText*>* pt_ptr_arr_ptr;
263 #endif
264 }; 240 };
265 typedef struct tag_gif_compress_struct gif_compress_struct; 241 typedef struct tag_gif_compress_struct gif_compress_struct;
266 typedef gif_compress_struct* gif_compress_struct_p; 242 typedef gif_compress_struct* gif_compress_struct_p;
267 typedef gif_compress_struct_p* gif_compress_struct_pp; 243 typedef gif_compress_struct_p* gif_compress_struct_pp;
268 struct tag_gif_compress_struct { 244 struct tag_gif_compress_struct {
269 const uint8_t* src_buf; 245 const uint8_t* src_buf;
270 FX_DWORD src_pitch; 246 FX_DWORD src_pitch;
271 FX_DWORD src_width; 247 FX_DWORD src_width;
272 FX_DWORD src_row; 248 FX_DWORD src_row;
273 FX_DWORD cur_offset; 249 FX_DWORD cur_offset;
274 FX_DWORD frames; 250 FX_DWORD frames;
275 GifHeader* header_ptr; 251 GifHeader* header_ptr;
276 GifLSD* lsd_ptr; 252 GifLSD* lsd_ptr;
277 GifPalette* global_pal; 253 GifPalette* global_pal;
278 FX_WORD gpal_num; 254 FX_WORD gpal_num;
279 GifPalette* local_pal; 255 GifPalette* local_pal;
280 FX_WORD lpal_num; 256 FX_WORD lpal_num;
281 GifImageInfo* image_info_ptr; 257 GifImageInfo* image_info_ptr;
282 CGifLZWEncoder* img_encoder_ptr; 258 CGifLZWEncoder* img_encoder_ptr;
283 #ifdef GIF_SUPPORT_APPLICATION_EXTENSION
284 uint8_t app_identify[8];
285 uint8_t app_authentication[3];
286 FX_DWORD app_data_size;
287 uint8_t* app_data;
288 #endif
289 259
290 #ifdef GIF_SUPPORT_COMMENT_EXTENSION
291 uint8_t* cmt_data_ptr; 260 uint8_t* cmt_data_ptr;
292 FX_DWORD cmt_data_len; 261 FX_DWORD cmt_data_len;
293 #endif
294
295 #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
296 GifGCE* gce_ptr; 262 GifGCE* gce_ptr;
297 #endif
298
299 #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
300 GifPTE* pte_ptr; 263 GifPTE* pte_ptr;
301 const uint8_t* pte_data_ptr; 264 const uint8_t* pte_data_ptr;
302 FX_DWORD pte_data_len; 265 FX_DWORD pte_data_len;
303 #endif
304 }; 266 };
305 267
306 void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); 268 void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
307 void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); 269 void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg);
308 gif_decompress_struct_p _gif_create_decompress(); 270 gif_decompress_struct_p gif_create_decompress();
309 void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr); 271 void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr);
310 gif_compress_struct_p _gif_create_compress(); 272 gif_compress_struct_p gif_create_compress();
311 void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr); 273 void gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr);
312 int32_t _gif_read_header(gif_decompress_struct_p gif_ptr); 274 int32_t gif_read_header(gif_decompress_struct_p gif_ptr);
313 int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr); 275 int32_t gif_get_frame(gif_decompress_struct_p gif_ptr);
314 int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr); 276 int32_t gif_get_frame_num(gif_decompress_struct_p gif_ptr);
315 int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr); 277 int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr);
316 int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr); 278 int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr);
317 void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr, 279 void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr,
318 GifGCE** gce_ptr_ptr); 280 GifGCE** gce_ptr_ptr);
319 int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num); 281 int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num);
320 uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr, 282 uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr,
321 uint8_t** des_buf_pp, 283 uint8_t** des_buf_pp,
322 FX_DWORD data_size); 284 FX_DWORD data_size);
323 void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status); 285 void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status);
324 void _gif_input_buffer(gif_decompress_struct_p gif_ptr, 286 void gif_input_buffer(gif_decompress_struct_p gif_ptr,
325 uint8_t* src_buf, 287 uint8_t* src_buf,
326 FX_DWORD src_size); 288 FX_DWORD src_size);
327 FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr, 289 FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr,
328 uint8_t** avial_buf_ptr); 290 uint8_t** avial_buf_ptr);
329 void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height); 291 void interlace_buf(const uint8_t* buf, FX_DWORD width, FX_DWORD height);
330 FX_BOOL _gif_encode(gif_compress_struct_p gif_ptr, 292 FX_BOOL gif_encode(gif_compress_struct_p gif_ptr,
331 uint8_t*& dst_buf, 293 uint8_t*& dst_buf,
332 FX_DWORD& dst_len); 294 FX_DWORD& dst_len);
333 295
334 #endif // CORE_SRC_FXCODEC_LGIF_FX_GIF_H_ 296 #endif // CORE_SRC_FXCODEC_LGIF_FX_GIF_H_
OLDNEW
« no previous file with comments | « core/src/fxcodec/lbmp/fx_bmp.cpp ('k') | core/src/fxcodec/lgif/fx_gif.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698