| Index: core/src/fxcodec/lgif/fx_gif.cpp
|
| diff --git a/core/src/fxcodec/lgif/fx_gif.cpp b/core/src/fxcodec/lgif/fx_gif.cpp
|
| index ffac89103228679cf93724beafaf1df53086a612..20632db2c9a6543ffd42f7d185dac705078059fe 100644
|
| --- a/core/src/fxcodec/lgif/fx_gif.cpp
|
| +++ b/core/src/fxcodec/lgif/fx_gif.cpp
|
| @@ -5,6 +5,9 @@
|
| // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
|
|
|
| #include "core/src/fxcodec/lgif/fx_gif.h"
|
| +
|
| +#include "core/src/fxcodec/lbmp/fx_bmp.h"
|
| +
|
| void CGifLZWDecoder::Input(uint8_t* src_buf, FX_DWORD src_size) {
|
| next_in = src_buf;
|
| avail_in = src_size;
|
| @@ -141,9 +144,9 @@ int32_t CGifLZWDecoder::Decode(uint8_t* des_buf, FX_DWORD& des_size) {
|
| }
|
| return 0;
|
| }
|
| -static FX_BOOL _gif_grow_buf(uint8_t*& dst_buf,
|
| - FX_DWORD& dst_len,
|
| - FX_DWORD size) {
|
| +static FX_BOOL gif_grow_buf(uint8_t*& dst_buf,
|
| + FX_DWORD& dst_len,
|
| + FX_DWORD size) {
|
| if (dst_len < size) {
|
| FX_DWORD len_org = dst_len;
|
| while (dst_buf && dst_len < size) {
|
| @@ -162,19 +165,19 @@ static FX_BOOL _gif_grow_buf(uint8_t*& dst_buf,
|
| }
|
| return TRUE;
|
| }
|
| -static inline void _gif_cut_index(uint8_t& val,
|
| - FX_DWORD index,
|
| - uint8_t index_bit,
|
| - uint8_t index_bit_use,
|
| - uint8_t bit_use) {
|
| +static inline void gif_cut_index(uint8_t& val,
|
| + FX_DWORD index,
|
| + uint8_t index_bit,
|
| + uint8_t index_bit_use,
|
| + uint8_t bit_use) {
|
| FX_DWORD cut = ((1 << (index_bit - index_bit_use)) - 1) << index_bit_use;
|
| val |= ((index & cut) >> index_bit_use) << bit_use;
|
| }
|
| -static inline uint8_t _gif_cut_buf(const uint8_t* buf,
|
| - FX_DWORD& offset,
|
| - uint8_t bit_cut,
|
| - uint8_t& bit_offset,
|
| - FX_DWORD& bit_num) {
|
| +static inline uint8_t gif_cut_buf(const uint8_t* buf,
|
| + FX_DWORD& offset,
|
| + uint8_t bit_cut,
|
| + uint8_t& bit_offset,
|
| + FX_DWORD& bit_num) {
|
| if (bit_cut != 8) {
|
| FX_WORD index = 0;
|
| index |= ((1 << bit_cut) - 1) << (7 - bit_offset);
|
| @@ -224,15 +227,15 @@ void CGifLZWEncoder::Start(uint8_t code_len,
|
| src_offset = 0;
|
| src_bit_offset = 0;
|
| src_bit_num = 0;
|
| - code_table[index_num].prefix = _gif_cut_buf(src_buf, src_offset, src_bit_cut,
|
| - src_bit_offset, src_bit_num);
|
| - code_table[index_num].suffix = _gif_cut_buf(src_buf, src_offset, src_bit_cut,
|
| - src_bit_offset, src_bit_num);
|
| + code_table[index_num].prefix = gif_cut_buf(src_buf, src_offset, src_bit_cut,
|
| + src_bit_offset, src_bit_num);
|
| + code_table[index_num].suffix = gif_cut_buf(src_buf, src_offset, src_bit_cut,
|
| + src_bit_offset, src_bit_num);
|
| }
|
| void CGifLZWEncoder::WriteBlock(uint8_t*& dst_buf,
|
| FX_DWORD& dst_len,
|
| FX_DWORD& offset) {
|
| - if (!_gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) {
|
| + if (!gif_grow_buf(dst_buf, dst_len, offset + GIF_DATA_BLOCK + 1)) {
|
| longjmp(jmp, 1);
|
| }
|
| dst_buf[offset++] = index_buf_len;
|
| @@ -250,8 +253,8 @@ void CGifLZWEncoder::EncodeString(FX_DWORD index,
|
| if (index_buf_len == GIF_DATA_BLOCK) {
|
| WriteBlock(dst_buf, dst_len, offset);
|
| }
|
| - _gif_cut_index(index_buf[index_buf_len], index, index_bit_cur, index_bit_use,
|
| - bit_offset);
|
| + gif_cut_index(index_buf[index_buf_len], index, index_bit_cur, index_bit_use,
|
| + bit_offset);
|
| if (index_bit_cur <= (8 - bit_offset)) {
|
| bit_offset += index_bit_cur;
|
| } else if (index_bit_cur <= (16 - bit_offset)) {
|
| @@ -261,8 +264,8 @@ void CGifLZWEncoder::EncodeString(FX_DWORD index,
|
| if (index_buf_len == GIF_DATA_BLOCK) {
|
| WriteBlock(dst_buf, dst_len, offset);
|
| }
|
| - _gif_cut_index(index_buf[index_buf_len], index, index_bit_cur,
|
| - index_bit_use, bit_offset);
|
| + gif_cut_index(index_buf[index_buf_len], index, index_bit_cur, index_bit_use,
|
| + bit_offset);
|
| bit_offset = index_bit_cur - index_bit_use;
|
| } else {
|
| index_bit_use += (8 - bit_offset);
|
| @@ -271,16 +274,16 @@ void CGifLZWEncoder::EncodeString(FX_DWORD index,
|
| if (index_buf_len == GIF_DATA_BLOCK) {
|
| WriteBlock(dst_buf, dst_len, offset);
|
| }
|
| - _gif_cut_index(index_buf[index_buf_len], index, index_bit_cur,
|
| - index_bit_use, bit_offset);
|
| + gif_cut_index(index_buf[index_buf_len], index, index_bit_cur, index_bit_use,
|
| + bit_offset);
|
| index_bit_use += 8;
|
| bit_offset = 0;
|
| index_buf_len++;
|
| if (index_buf_len == GIF_DATA_BLOCK) {
|
| WriteBlock(dst_buf, dst_len, offset);
|
| }
|
| - _gif_cut_index(index_buf[index_buf_len], index, index_bit_cur,
|
| - index_bit_use, bit_offset);
|
| + gif_cut_index(index_buf[index_buf_len], index, index_bit_cur, index_bit_use,
|
| + bit_offset);
|
| bit_offset = index_bit_cur - index_bit_use;
|
| }
|
| if (bit_offset == 8) {
|
| @@ -315,11 +318,11 @@ FX_BOOL CGifLZWEncoder::Encode(const uint8_t* src_buf,
|
| EncodeString(code_clear, dst_buf, dst_len, offset);
|
| ClearTable();
|
| code_table[index_num].prefix = suffix;
|
| - code_table[index_num].suffix = _gif_cut_buf(
|
| + code_table[index_num].suffix = gif_cut_buf(
|
| src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
|
| } else {
|
| code_table[index_num].prefix = code_table[index_num - 1].suffix;
|
| - code_table[index_num].suffix = _gif_cut_buf(
|
| + code_table[index_num].suffix = gif_cut_buf(
|
| src_buf, src_offset, src_bit_cut, src_bit_offset, src_bit_num);
|
| }
|
| }
|
| @@ -337,7 +340,7 @@ FX_BOOL CGifLZWEncoder::LookUpInTable(const uint8_t* buf,
|
| code_table[i].suffix == code_table[index_num].suffix) {
|
| code_table[index_num].prefix = i;
|
| code_table[index_num].suffix =
|
| - _gif_cut_buf(buf, offset, src_bit_cut, bit_offset, src_bit_num);
|
| + gif_cut_buf(buf, offset, src_bit_cut, bit_offset, src_bit_num);
|
| table_cur = i;
|
| return TRUE;
|
| }
|
| @@ -353,7 +356,7 @@ void CGifLZWEncoder::Finish(uint8_t*& dst_buf,
|
| bit_offset = 0;
|
| ClearTable();
|
| }
|
| -gif_decompress_struct_p _gif_create_decompress() {
|
| +gif_decompress_struct_p gif_create_decompress() {
|
| gif_decompress_struct_p gif_ptr =
|
| (gif_decompress_struct*)FX_Alloc(uint8_t, sizeof(gif_decompress_struct));
|
| if (gif_ptr == NULL) {
|
| @@ -370,7 +373,7 @@ gif_decompress_struct_p _gif_create_decompress() {
|
| #endif
|
| return gif_ptr;
|
| }
|
| -void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
|
| +void gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
|
| if (gif_ptr_ptr == NULL || *gif_ptr_ptr == NULL) {
|
| return;
|
| }
|
| @@ -417,7 +420,7 @@ void _gif_destroy_decompress(gif_decompress_struct_pp gif_ptr_ptr) {
|
| #endif
|
| FX_Free(gif_ptr);
|
| }
|
| -gif_compress_struct_p _gif_create_compress() {
|
| +gif_compress_struct_p gif_create_compress() {
|
| gif_compress_struct_p gif_ptr =
|
| (gif_compress_struct*)FX_Alloc(uint8_t, sizeof(gif_compress_struct));
|
| if (gif_ptr == NULL) {
|
| @@ -482,7 +485,7 @@ gif_compress_struct_p _gif_create_compress() {
|
| #endif
|
| return gif_ptr;
|
| }
|
| -void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) {
|
| +void gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) {
|
| if (gif_ptr_ptr == NULL || *gif_ptr_ptr == NULL) {
|
| return;
|
| }
|
| @@ -508,30 +511,30 @@ void _gif_destroy_compress(gif_compress_struct_pp gif_ptr_ptr) {
|
| #endif
|
| FX_Free(gif_ptr);
|
| }
|
| -void _gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {
|
| +void gif_error(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {
|
| if (gif_ptr && gif_ptr->_gif_error_fn) {
|
| gif_ptr->_gif_error_fn(gif_ptr, err_msg);
|
| }
|
| }
|
| -void _gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}
|
| -int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) {
|
| +void gif_warn(gif_decompress_struct_p gif_ptr, const FX_CHAR* err_msg) {}
|
| +int32_t gif_read_header(gif_decompress_struct_p gif_ptr) {
|
| if (gif_ptr == NULL) {
|
| return 0;
|
| }
|
| FX_DWORD skip_size_org = gif_ptr->skip_size;
|
| ASSERT(sizeof(GifHeader) == 6);
|
| GifHeader* gif_header_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_header_ptr, 6) == NULL) {
|
| return 2;
|
| }
|
| if (FXSYS_strncmp(gif_header_ptr->signature, GIF_SIGNATURE, 3) != 0 ||
|
| gif_header_ptr->version[0] != '8' || gif_header_ptr->version[2] != 'a') {
|
| - _gif_error(gif_ptr, "Not A Gif Image");
|
| + gif_error(gif_ptr, "Not A Gif Image");
|
| return 0;
|
| }
|
| ASSERT(sizeof(GifLSD) == 7);
|
| GifLSD* gif_lsd_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_lsd_ptr, 7) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_lsd_ptr, 7) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| @@ -541,7 +544,7 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) {
|
| ASSERT(sizeof(GifPalette) == 3);
|
| int32_t global_pal_size = gif_ptr->global_pal_num * 3;
|
| uint8_t* global_pal_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
|
| + if (gif_read_data(gif_ptr, &global_pal_ptr, global_pal_size) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| @@ -552,13 +555,13 @@ int32_t _gif_read_header(gif_decompress_struct_p gif_ptr) {
|
| gif_ptr->global_pal_ptr = (GifPalette*)FX_Alloc(uint8_t, global_pal_size);
|
| FXSYS_memcpy(gif_ptr->global_pal_ptr, global_pal_ptr, global_pal_size);
|
| }
|
| - gif_ptr->width = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
|
| - gif_ptr->height = (int)_GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);
|
| + gif_ptr->width = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->width);
|
| + gif_ptr->height = (int)GetWord_LSBFirst((uint8_t*)&gif_lsd_ptr->height);
|
| gif_ptr->bc_index = gif_lsd_ptr->bc_index;
|
| gif_ptr->pixel_aspect = gif_lsd_ptr->pixel_aspect;
|
| return 1;
|
| }
|
| -int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| +int32_t gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| if (gif_ptr == NULL) {
|
| return 0;
|
| }
|
| @@ -569,53 +572,53 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| return 1;
|
| case GIF_D_STATUS_SIG: {
|
| uint8_t* sig_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, &sig_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &sig_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| switch (*sig_ptr) {
|
| case GIF_SIG_EXTENSION:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT);
|
| continue;
|
| case GIF_SIG_IMAGE:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_INFO);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_INFO);
|
| continue;
|
| case GIF_SIG_TRAILER:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| return 1;
|
| default:
|
| if (gif_ptr->avail_in) {
|
| - _gif_warn(gif_ptr, "The Gif File has non_standard Tag!");
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| + gif_warn(gif_ptr, "The Gif File has non_standard Tag!");
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| continue;
|
| }
|
| - _gif_warn(gif_ptr, "The Gif File Doesn't have Trailer Tag!");
|
| + gif_warn(gif_ptr, "The Gif File Doesn't have Trailer Tag!");
|
| return 1;
|
| }
|
| }
|
| case GIF_D_STATUS_EXT: {
|
| uint8_t* ext_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, &ext_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &ext_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| switch (*ext_ptr) {
|
| #ifdef GIF_SUPPORT_APPLICATION_EXTENSION
|
| case GIF_BLOCK_AE:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_AE);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_AE);
|
| continue;
|
| #endif
|
| #ifdef GIF_SUPPORT_COMMENT_EXTENSION
|
| case GIF_BLOCK_CE:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_CE);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_CE);
|
| continue;
|
| #endif
|
| #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
|
| case GIF_BLOCK_GCE:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_GCE);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_GCE);
|
| continue;
|
| #endif
|
| #ifdef GIF_SUPPORT_PLAIN_TEXT_EXTENSION
|
| case GIF_BLOCK_PTE:
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_PTE);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_EXT_PTE);
|
| continue;
|
| #endif
|
| default: {
|
| @@ -625,13 +628,13 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| status = GIF_D_STATUS_EXT_PTE;
|
| }
|
| #endif
|
| - _gif_save_decoding_status(gif_ptr, status);
|
| + gif_save_decoding_status(gif_ptr, status);
|
| continue;
|
| }
|
| }
|
| }
|
| case GIF_D_STATUS_IMG_INFO: {
|
| - ret = _gif_decode_image_info(gif_ptr);
|
| + ret = gif_decode_image_info(gif_ptr);
|
| if (ret != 1) {
|
| return ret;
|
| }
|
| @@ -641,25 +644,25 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| uint8_t* data_size_ptr = NULL;
|
| uint8_t* data_ptr = NULL;
|
| FX_DWORD skip_size_org = gif_ptr->skip_size;
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| while (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| skip_size_org = gif_ptr->skip_size;
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| }
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| continue;
|
| }
|
| default: {
|
| - ret = _gif_decode_extension(gif_ptr);
|
| + ret = gif_decode_extension(gif_ptr);
|
| if (ret != 1) {
|
| return ret;
|
| }
|
| @@ -669,8 +672,8 @@ int32_t _gif_get_frame(gif_decompress_struct_p gif_ptr) {
|
| }
|
| return 1;
|
| }
|
| -void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr,
|
| - GifGCE** gce_ptr_ptr) {
|
| +void gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr,
|
| + GifGCE** gce_ptr_ptr) {
|
| *gce_ptr_ptr = NULL;
|
| #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
|
| if (gif_ptr->gce_ptr && gce_ptr_ptr) {
|
| @@ -679,7 +682,7 @@ void _gif_takeover_gce_ptr(gif_decompress_struct_p gif_ptr,
|
| }
|
| #endif
|
| }
|
| -int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| +int32_t gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| uint8_t* data_size_ptr = NULL;
|
| uint8_t* data_ptr = NULL;
|
| FX_DWORD skip_size_org = gif_ptr->skip_size;
|
| @@ -688,18 +691,18 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| case GIF_D_STATUS_EXT_AE: {
|
| ASSERT(sizeof(GifAE) == 12);
|
| GifAE* gif_ae_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_ae_ptr, 12) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_ae_ptr, 12) == NULL) {
|
| return 2;
|
| }
|
| CFX_ByteString gif_ae_data_str;
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| while (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| uint8_t data_size = *data_size_ptr;
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| - _gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| + gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| @@ -717,15 +720,15 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| #endif
|
| #ifdef GIF_SUPPORT_COMMENT_EXTENSION
|
| case GIF_D_STATUS_EXT_CE: {
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| gif_ptr->cmt_data_ptr->Empty();
|
| while (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| uint8_t data_size = *data_size_ptr;
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| - _gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| + gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| @@ -738,28 +741,28 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| case GIF_D_STATUS_EXT_PTE: {
|
| ASSERT(sizeof(GifPTE) == 13);
|
| GifPTE* gif_pte_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_pte_ptr, 13) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_pte_ptr, 13) == NULL) {
|
| return 2;
|
| }
|
| GifPlainText* gif_pt_ptr = FX_Alloc(GifPlainText, 1);
|
| FXSYS_memset(gif_pt_ptr, 0, sizeof(GifPlainText));
|
| - _gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
|
| + gif_takeover_gce_ptr(gif_ptr, &gif_pt_ptr->gce_ptr);
|
| gif_pt_ptr->pte_ptr = (GifPTE*)FX_Alloc(uint8_t, sizeof(GifPTE));
|
| gif_pt_ptr->string_ptr = new CFX_ByteString;
|
| gif_pt_ptr->pte_ptr->block_size = gif_pte_ptr->block_size;
|
| gif_pt_ptr->pte_ptr->grid_left =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);
|
| + GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_left);
|
| gif_pt_ptr->pte_ptr->grid_top =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_top);
|
| + GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_top);
|
| gif_pt_ptr->pte_ptr->grid_width =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_width);
|
| + GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_width);
|
| gif_pt_ptr->pte_ptr->grid_height =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_height);
|
| + GetWord_LSBFirst((uint8_t*)&gif_pte_ptr->grid_height);
|
| gif_pt_ptr->pte_ptr->char_width = gif_pte_ptr->char_width;
|
| gif_pt_ptr->pte_ptr->char_height = gif_pte_ptr->char_height;
|
| gif_pt_ptr->pte_ptr->fc_index = gif_pte_ptr->fc_index;
|
| gif_pt_ptr->pte_ptr->bc_index = gif_pte_ptr->bc_index;
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| if (gif_pt_ptr) {
|
| FX_Free(gif_pt_ptr->gce_ptr);
|
| @@ -771,8 +774,8 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| }
|
| while (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| uint8_t data_size = *data_size_ptr;
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| - _gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| + gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| if (gif_pt_ptr) {
|
| FX_Free(gif_pt_ptr->gce_ptr);
|
| @@ -792,7 +795,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| case GIF_D_STATUS_EXT_GCE: {
|
| ASSERT(sizeof(GifGCE) == 5);
|
| GifGCE* gif_gce_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_gce_ptr, 6) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_gce_ptr, 6) == NULL) {
|
| return 2;
|
| }
|
| if (gif_ptr->gce_ptr == NULL) {
|
| @@ -801,7 +804,7 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| gif_ptr->gce_ptr->block_size = gif_gce_ptr->block_size;
|
| gif_ptr->gce_ptr->gce_flag = gif_gce_ptr->gce_flag;
|
| gif_ptr->gce_ptr->delay_time =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_gce_ptr->delay_time);
|
| + GetWord_LSBFirst((uint8_t*)&gif_gce_ptr->delay_time);
|
| gif_ptr->gce_ptr->trans_index = gif_gce_ptr->trans_index;
|
| } break;
|
| #endif
|
| @@ -814,30 +817,30 @@ int32_t _gif_decode_extension(gif_decompress_struct_p gif_ptr) {
|
| }
|
| #endif
|
| #endif
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| while (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| - _gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL ||
|
| + gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| }
|
| }
|
| }
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_SIG);
|
| return 1;
|
| }
|
| -int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| +int32_t gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| if (gif_ptr->width == 0 || gif_ptr->height == 0) {
|
| - _gif_error(gif_ptr, "No Image Header Info");
|
| + gif_error(gif_ptr, "No Image Header Info");
|
| return 0;
|
| }
|
| FX_DWORD skip_size_org = gif_ptr->skip_size;
|
| ASSERT(sizeof(GifImageInfo) == 9);
|
| GifImageInfo* gif_img_info_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) {
|
| + if (gif_read_data(gif_ptr, (uint8_t**)&gif_img_info_ptr, 9) == NULL) {
|
| return 2;
|
| }
|
| GifImage* gif_image_ptr = (GifImage*)FX_Alloc(uint8_t, sizeof(GifImage));
|
| @@ -845,13 +848,13 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| gif_image_ptr->image_info_ptr =
|
| (GifImageInfo*)FX_Alloc(uint8_t, sizeof(GifImageInfo));
|
| gif_image_ptr->image_info_ptr->left =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
|
| + GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->left);
|
| gif_image_ptr->image_info_ptr->top =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->top);
|
| + GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->top);
|
| gif_image_ptr->image_info_ptr->width =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->width);
|
| + GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->width);
|
| gif_image_ptr->image_info_ptr->height =
|
| - _GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->height);
|
| + GetWord_LSBFirst((uint8_t*)&gif_img_info_ptr->height);
|
| gif_image_ptr->image_info_ptr->local_flag = gif_img_info_ptr->local_flag;
|
| if (gif_image_ptr->image_info_ptr->left +
|
| gif_image_ptr->image_info_ptr->width >
|
| @@ -862,7 +865,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| FX_Free(gif_image_ptr->image_info_ptr);
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| FX_Free(gif_image_ptr);
|
| - _gif_error(gif_ptr, "Image Data Out Of LSD, The File May Be Corrupt");
|
| + gif_error(gif_ptr, "Image Data Out Of LSD, The File May Be Corrupt");
|
| return 0;
|
| }
|
| GifLF* gif_img_info_lf_ptr = (GifLF*)&gif_img_info_ptr->local_flag;
|
| @@ -870,7 +873,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| ASSERT(sizeof(GifPalette) == 3);
|
| int32_t loc_pal_size = (2 << gif_img_info_lf_ptr->pal_bits) * 3;
|
| uint8_t* loc_pal_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
|
| + if (gif_read_data(gif_ptr, &loc_pal_ptr, loc_pal_size) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| FX_Free(gif_image_ptr->image_info_ptr);
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| @@ -885,7 +888,7 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| }
|
| }
|
| uint8_t* code_size_ptr = NULL;
|
| - if (_gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &code_size_ptr, 1) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| FX_Free(gif_image_ptr->image_info_ptr);
|
| FX_Free(gif_image_ptr->local_pal_ptr);
|
| @@ -897,12 +900,12 @@ int32_t _gif_decode_image_info(gif_decompress_struct_p gif_ptr) {
|
| gif_ptr->_gif_record_current_position_fn(gif_ptr,
|
| &gif_image_ptr->image_data_pos);
|
| gif_image_ptr->image_data_pos += gif_ptr->skip_size;
|
| - _gif_takeover_gce_ptr(gif_ptr, &gif_image_ptr->image_gce_ptr);
|
| + gif_takeover_gce_ptr(gif_ptr, &gif_image_ptr->image_gce_ptr);
|
| gif_ptr->img_ptr_arr_ptr->Add(gif_image_ptr);
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| return 1;
|
| }
|
| -int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| +int32_t gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| if (gif_ptr == NULL || frame_num < 0 ||
|
| frame_num >= gif_ptr->img_ptr_arr_ptr->GetSize()) {
|
| return 0;
|
| @@ -938,7 +941,7 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| if (!bRes) {
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| gif_image_ptr->image_row_buf = NULL;
|
| - _gif_error(gif_ptr, "Error Read Record Position Data");
|
| + gif_error(gif_ptr, "Error Read Record Position Data");
|
| return 0;
|
| }
|
| } else {
|
| @@ -962,7 +965,7 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| if (!bRes) {
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| gif_image_ptr->image_row_buf = NULL;
|
| - _gif_error(gif_ptr, "Error Read Record Position Data");
|
| + gif_error(gif_ptr, "Error Read Record Position Data");
|
| return 0;
|
| }
|
| }
|
| @@ -974,20 +977,20 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| gif_ptr->img_row_avail_size = 0;
|
| gif_ptr->img_pass_num = 0;
|
| gif_image_ptr->image_row_num = 0;
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| }
|
| CGifLZWDecoder* img_decoder_ptr = gif_ptr->img_decoder_ptr;
|
| if (gif_ptr->decode_status == GIF_D_STATUS_IMG_DATA) {
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| if (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| img_decoder_ptr->Input(data_ptr, *data_size_ptr);
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| gif_ptr->img_row_offset += gif_ptr->img_row_avail_size;
|
| gif_ptr->img_row_avail_size = gif_img_row_bytes - gif_ptr->img_row_offset;
|
| int32_t ret = img_decoder_ptr->Decode(
|
| @@ -996,8 +999,8 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| if (ret == 0) {
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| gif_image_ptr->image_row_buf = NULL;
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| - _gif_error(gif_ptr, "Decode Image Data Error");
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| + gif_error(gif_ptr, "Decode Image Data Error");
|
| return 0;
|
| }
|
| while (ret != 0) {
|
| @@ -1006,22 +1009,22 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| gif_image_ptr->image_row_buf);
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| gif_image_ptr->image_row_buf = NULL;
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| return 1;
|
| }
|
| if (ret == 2) {
|
| ASSERT(img_decoder_ptr->GetAvailInput() == 0);
|
| skip_size_org = gif_ptr->skip_size;
|
| - if (_gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_size_ptr, 1) == NULL) {
|
| return 2;
|
| }
|
| if (*data_size_ptr != GIF_BLOCK_TERMINAL) {
|
| - if (_gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| + if (gif_read_data(gif_ptr, &data_ptr, *data_size_ptr) == NULL) {
|
| gif_ptr->skip_size = skip_size_org;
|
| return 2;
|
| }
|
| img_decoder_ptr->Input(data_ptr, *data_size_ptr);
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_IMG_DATA);
|
| gif_ptr->img_row_offset += gif_ptr->img_row_avail_size;
|
| gif_ptr->img_row_avail_size =
|
| gif_img_row_bytes - gif_ptr->img_row_offset;
|
| @@ -1055,27 +1058,26 @@ int32_t _gif_load_frame(gif_decompress_struct_p gif_ptr, int32_t frame_num) {
|
| if (ret == 0) {
|
| FX_Free(gif_image_ptr->image_row_buf);
|
| gif_image_ptr->image_row_buf = NULL;
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| - _gif_error(gif_ptr, "Decode Image Data Error");
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| + gif_error(gif_ptr, "Decode Image Data Error");
|
| return 0;
|
| }
|
| }
|
| }
|
| - _gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| + gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL);
|
| }
|
| - _gif_error(gif_ptr, "Decode Image Data Error");
|
| + gif_error(gif_ptr, "Decode Image Data Error");
|
| return 0;
|
| }
|
| -void _gif_save_decoding_status(gif_decompress_struct_p gif_ptr,
|
| - int32_t status) {
|
| +void gif_save_decoding_status(gif_decompress_struct_p gif_ptr, int32_t status) {
|
| gif_ptr->decode_status = status;
|
| gif_ptr->next_in += gif_ptr->skip_size;
|
| gif_ptr->avail_in -= gif_ptr->skip_size;
|
| gif_ptr->skip_size = 0;
|
| }
|
| -uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr,
|
| - uint8_t** des_buf_pp,
|
| - FX_DWORD data_size) {
|
| +uint8_t* gif_read_data(gif_decompress_struct_p gif_ptr,
|
| + uint8_t** des_buf_pp,
|
| + FX_DWORD data_size) {
|
| if (gif_ptr == NULL || gif_ptr->avail_in < gif_ptr->skip_size + data_size) {
|
| return NULL;
|
| }
|
| @@ -1083,15 +1085,15 @@ uint8_t* _gif_read_data(gif_decompress_struct_p gif_ptr,
|
| gif_ptr->skip_size += data_size;
|
| return *des_buf_pp;
|
| }
|
| -void _gif_input_buffer(gif_decompress_struct_p gif_ptr,
|
| - uint8_t* src_buf,
|
| - FX_DWORD src_size) {
|
| +void gif_input_buffer(gif_decompress_struct_p gif_ptr,
|
| + uint8_t* src_buf,
|
| + FX_DWORD src_size) {
|
| gif_ptr->next_in = src_buf;
|
| gif_ptr->avail_in = src_size;
|
| gif_ptr->skip_size = 0;
|
| }
|
| -FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr,
|
| - uint8_t** avial_buf_ptr) {
|
| +FX_DWORD gif_get_avail_input(gif_decompress_struct_p gif_ptr,
|
| + uint8_t** avial_buf_ptr) {
|
| if (avial_buf_ptr) {
|
| *avial_buf_ptr = NULL;
|
| if (gif_ptr->avail_in > 0) {
|
| @@ -1100,12 +1102,12 @@ FX_DWORD _gif_get_avail_input(gif_decompress_struct_p gif_ptr,
|
| }
|
| return gif_ptr->avail_in;
|
| }
|
| -int32_t _gif_get_frame_num(gif_decompress_struct_p gif_ptr) {
|
| +int32_t gif_get_frame_num(gif_decompress_struct_p gif_ptr) {
|
| return gif_ptr->img_ptr_arr_ptr->GetSize();
|
| }
|
| -static FX_BOOL _gif_write_header(gif_compress_struct_p gif_ptr,
|
| - uint8_t*& dst_buf,
|
| - FX_DWORD& dst_len) {
|
| +static FX_BOOL gif_write_header(gif_compress_struct_p gif_ptr,
|
| + uint8_t*& dst_buf,
|
| + FX_DWORD& dst_len) {
|
| if (gif_ptr->cur_offset) {
|
| return TRUE;
|
| }
|
| @@ -1117,16 +1119,16 @@ static FX_BOOL _gif_write_header(gif_compress_struct_p gif_ptr,
|
| FXSYS_memset(dst_buf, 0, dst_len);
|
| FXSYS_memcpy(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader));
|
| gif_ptr->cur_offset += sizeof(GifHeader);
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height);
|
| gif_ptr->cur_offset += 2;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->lsd_ptr->global_flag;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->lsd_ptr->bc_index;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->lsd_ptr->pixel_aspect;
|
| if (gif_ptr->global_pal) {
|
| FX_WORD size = sizeof(GifPalette) * gif_ptr->gpal_num;
|
| - if (!_gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) {
|
| + if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + size)) {
|
| return FALSE;
|
| }
|
| FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->global_pal, size);
|
| @@ -1165,11 +1167,11 @@ void interlace_buf(const uint8_t* buf, FX_DWORD pitch, FX_DWORD height) {
|
| }
|
| }
|
| }
|
| -static void _gif_write_block_data(const uint8_t* src_buf,
|
| - FX_DWORD src_len,
|
| - uint8_t*& dst_buf,
|
| - FX_DWORD& dst_len,
|
| - FX_DWORD& dst_offset) {
|
| +static void gif_write_block_data(const uint8_t* src_buf,
|
| + FX_DWORD src_len,
|
| + uint8_t*& dst_buf,
|
| + FX_DWORD& dst_len,
|
| + FX_DWORD& dst_offset) {
|
| FX_DWORD src_offset = 0;
|
| while (src_len > GIF_DATA_BLOCK) {
|
| dst_buf[dst_offset++] = GIF_DATA_BLOCK;
|
| @@ -1182,10 +1184,10 @@ static void _gif_write_block_data(const uint8_t* src_buf,
|
| FXSYS_memcpy(&dst_buf[dst_offset], &src_buf[src_offset], src_len);
|
| dst_offset += src_len;
|
| }
|
| -static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| - uint8_t*& dst_buf,
|
| - FX_DWORD& dst_len) {
|
| - if (!_gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
|
| +static FX_BOOL gif_write_data(gif_compress_struct_p gif_ptr,
|
| + uint8_t*& dst_buf,
|
| + FX_DWORD& dst_len) {
|
| + if (!gif_grow_buf(dst_buf, dst_len, gif_ptr->cur_offset + GIF_DATA_BLOCK)) {
|
| return FALSE;
|
| }
|
| #ifdef GIF_SUPPORT_GRAPHIC_CONTROL_EXTENSION
|
| @@ -1197,8 +1199,8 @@ static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| gif_ptr->gce_ptr->gce_flag = 0;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->gce_ptr->gce_flag;
|
| gif_ptr->gce_ptr->delay_time = 10;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->gce_ptr->delay_time);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->gce_ptr->delay_time);
|
| gif_ptr->cur_offset += 2;
|
| gif_ptr->gce_ptr->trans_index = 0;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->gce_ptr->trans_index;
|
| @@ -1206,23 +1208,22 @@ static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| }
|
| #endif
|
| dst_buf[gif_ptr->cur_offset++] = GIF_SIG_IMAGE;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->image_info_ptr->left);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->image_info_ptr->left);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->image_info_ptr->top);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->image_info_ptr->top);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->image_info_ptr->width);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->image_info_ptr->width);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->image_info_ptr->height);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->image_info_ptr->height);
|
| gif_ptr->cur_offset += 2;
|
| GifLF& lf = (GifLF&)gif_ptr->image_info_ptr->local_flag;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->image_info_ptr->local_flag;
|
| if (gif_ptr->local_pal) {
|
| FX_DWORD pal_size = sizeof(GifPalette) * gif_ptr->lpal_num;
|
| - if (!_gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) {
|
| + if (!gif_grow_buf(dst_buf, dst_len, pal_size + gif_ptr->cur_offset)) {
|
| return FALSE;
|
| }
|
| FXSYS_memcpy(&dst_buf[gif_ptr->cur_offset], gif_ptr->local_pal, pal_size);
|
| @@ -1255,8 +1256,8 @@ static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| gif_ptr->cmt_data_ptr) {
|
| dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
|
| dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_CE;
|
| - _gif_write_block_data(gif_ptr->cmt_data_ptr, gif_ptr->cmt_data_len, dst_buf,
|
| - dst_len, gif_ptr->cur_offset);
|
| + gif_write_block_data(gif_ptr->cmt_data_ptr, gif_ptr->cmt_data_len, dst_buf,
|
| + dst_len, gif_ptr->cur_offset);
|
| dst_buf[gif_ptr->cur_offset++] = 0;
|
| }
|
| #endif
|
| @@ -1266,32 +1267,29 @@ static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| dst_buf[gif_ptr->cur_offset++] = GIF_SIG_EXTENSION;
|
| dst_buf[gif_ptr->cur_offset++] = GIF_BLOCK_PTE;
|
| dst_buf[gif_ptr->cur_offset++] = gif_ptr->pte_ptr->block_size;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->grid_left);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->pte_ptr->grid_left);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->grid_top);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->pte_ptr->grid_top);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->grid_width);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->pte_ptr->grid_width);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->grid_height);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->pte_ptr->grid_height);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->char_width);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->pte_ptr->char_width);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->char_height);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| + gif_ptr->pte_ptr->char_height);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->fc_index);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->pte_ptr->fc_index);
|
| gif_ptr->cur_offset += 2;
|
| - _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset,
|
| - gif_ptr->pte_ptr->bc_index);
|
| + SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->pte_ptr->bc_index);
|
| gif_ptr->cur_offset += 2;
|
| - _gif_write_block_data(gif_ptr->pte_data_ptr, gif_ptr->pte_data_len, dst_buf,
|
| - dst_len, gif_ptr->cur_offset);
|
| + gif_write_block_data(gif_ptr->pte_data_ptr, gif_ptr->pte_data_len, dst_buf,
|
| + dst_len, gif_ptr->cur_offset);
|
| gif_ptr->cur_offset += gif_ptr->pte_data_len;
|
| dst_buf[gif_ptr->cur_offset++] = 0;
|
| }
|
| @@ -1315,10 +1313,10 @@ static FX_BOOL _gif_write_data(gif_compress_struct_p gif_ptr,
|
| dst_buf[gif_ptr->cur_offset++] = GIF_SIG_TRAILER;
|
| return TRUE;
|
| }
|
| -FX_BOOL _gif_encode(gif_compress_struct_p gif_ptr,
|
| - uint8_t*& dst_buf,
|
| - FX_DWORD& dst_len) {
|
| - if (!_gif_write_header(gif_ptr, dst_buf, dst_len)) {
|
| +FX_BOOL gif_encode(gif_compress_struct_p gif_ptr,
|
| + uint8_t*& dst_buf,
|
| + FX_DWORD& dst_len) {
|
| + if (!gif_write_header(gif_ptr, dst_buf, dst_len)) {
|
| return FALSE;
|
| }
|
| FX_DWORD cur_offset = gif_ptr->cur_offset;
|
| @@ -1326,7 +1324,7 @@ FX_BOOL _gif_encode(gif_compress_struct_p gif_ptr,
|
| if (gif_ptr->frames) {
|
| gif_ptr->cur_offset--;
|
| }
|
| - if (!_gif_write_data(gif_ptr, dst_buf, dst_len)) {
|
| + if (!gif_write_data(gif_ptr, dst_buf, dst_len)) {
|
| gif_ptr->cur_offset = cur_offset;
|
| res = FALSE;
|
| }
|
|
|