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 "core/fxcodec/codec/codec_int.h" | 7 #include "core/fxcodec/codec/codec_int.h" |
8 #include "core/fxcodec/lgif/fx_gif.h" | 8 #include "core/fxcodec/lgif/fx_gif.h" |
9 #include "core/include/fxcodec/fx_codec.h" | 9 #include "core/include/fxcodec/fx_codec.h" |
10 #include "core/include/fxge/fx_dib.h" | 10 #include "core/include/fxge/fx_dib.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 longjmp(gif_ptr->jmpbuf, 1); | 30 longjmp(gif_ptr->jmpbuf, 1); |
31 } | 31 } |
32 static uint8_t* gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, | 32 static uint8_t* gif_ask_buf_for_pal(gif_decompress_struct_p gif_ptr, |
33 int32_t pal_size) { | 33 int32_t pal_size) { |
34 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; | 34 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; |
35 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; | 35 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; |
36 return pModule->AskLocalPaletteBufCallback( | 36 return pModule->AskLocalPaletteBufCallback( |
37 p->child_ptr, gif_get_frame_num(gif_ptr), pal_size); | 37 p->child_ptr, gif_get_frame_num(gif_ptr), pal_size); |
38 } | 38 } |
39 static void gif_record_current_position(gif_decompress_struct_p gif_ptr, | 39 static void gif_record_current_position(gif_decompress_struct_p gif_ptr, |
40 FX_DWORD* cur_pos_ptr) { | 40 uint32_t* cur_pos_ptr) { |
41 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; | 41 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; |
42 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; | 42 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; |
43 pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr); | 43 pModule->RecordCurrentPositionCallback(p->child_ptr, *cur_pos_ptr); |
44 } | 44 } |
45 static void gif_read_scanline(gif_decompress_struct_p gif_ptr, | 45 static void gif_read_scanline(gif_decompress_struct_p gif_ptr, |
46 int32_t row_num, | 46 int32_t row_num, |
47 uint8_t* row_buf) { | 47 uint8_t* row_buf) { |
48 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; | 48 FXGIF_Context* p = (FXGIF_Context*)gif_ptr->context_ptr; |
49 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; | 49 CCodec_GifModule* pModule = (CCodec_GifModule*)p->parent_ptr; |
50 pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); | 50 pModule->ReadScanlineCallback(p->child_ptr, row_num, row_buf); |
51 } | 51 } |
52 static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr, | 52 static FX_BOOL gif_get_record_position(gif_decompress_struct_p gif_ptr, |
53 FX_DWORD cur_pos, | 53 uint32_t cur_pos, |
54 int32_t left, | 54 int32_t left, |
55 int32_t top, | 55 int32_t top, |
56 int32_t width, | 56 int32_t width, |
57 int32_t height, | 57 int32_t height, |
58 int32_t pal_num, | 58 int32_t pal_num, |
59 void* pal_ptr, | 59 void* pal_ptr, |
60 int32_t delay_time, | 60 int32_t delay_time, |
61 FX_BOOL user_input, | 61 FX_BOOL user_input, |
62 int32_t trans_index, | 62 int32_t trans_index, |
63 int32_t disposal_method, | 63 int32_t disposal_method, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (ret == 1) { | 148 if (ret == 1) { |
149 if (pAttribute) { | 149 if (pAttribute) { |
150 pAttribute->m_nGifLeft = | 150 pAttribute->m_nGifLeft = |
151 p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->left; | 151 p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->left; |
152 pAttribute->m_nGifTop = | 152 pAttribute->m_nGifTop = |
153 p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->top; | 153 p->gif_ptr->img_ptr_arr_ptr->GetAt(frame_num)->image_info_ptr->top; |
154 pAttribute->m_fAspectRatio = p->gif_ptr->pixel_aspect; | 154 pAttribute->m_fAspectRatio = p->gif_ptr->pixel_aspect; |
155 if (p->gif_ptr->cmt_data_ptr) { | 155 if (p->gif_ptr->cmt_data_ptr) { |
156 const uint8_t* buf = | 156 const uint8_t* buf = |
157 (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0); | 157 (const uint8_t*)p->gif_ptr->cmt_data_ptr->GetBuffer(0); |
158 FX_DWORD len = p->gif_ptr->cmt_data_ptr->GetLength(); | 158 uint32_t len = p->gif_ptr->cmt_data_ptr->GetLength(); |
159 if (len > 21) { | 159 if (len > 21) { |
160 uint8_t size = *buf++; | 160 uint8_t size = *buf++; |
161 if (size) { | 161 if (size) { |
162 pAttribute->m_strAuthor = CFX_ByteString(buf, size); | 162 pAttribute->m_strAuthor = CFX_ByteString(buf, size); |
163 } else { | 163 } else { |
164 pAttribute->m_strAuthor.Empty(); | 164 pAttribute->m_strAuthor.Empty(); |
165 } | 165 } |
166 buf += size; | 166 buf += size; |
167 size = *buf++; | 167 size = *buf++; |
168 if (size == 20) { | 168 if (size == 20) { |
169 FXSYS_memcpy(pAttribute->m_strTime, buf, size); | 169 FXSYS_memcpy(pAttribute->m_strTime, buf, size); |
170 } | 170 } |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
174 } | 174 } |
175 return ret; | 175 return ret; |
176 } | 176 } |
177 FX_DWORD CCodec_GifModule::GetAvailInput(void* pContext, | 177 uint32_t CCodec_GifModule::GetAvailInput(void* pContext, |
178 uint8_t** avial_buf_ptr) { | 178 uint8_t** avial_buf_ptr) { |
179 FXGIF_Context* p = (FXGIF_Context*)pContext; | 179 FXGIF_Context* p = (FXGIF_Context*)pContext; |
180 return gif_get_avail_input(p->gif_ptr, avial_buf_ptr); | 180 return gif_get_avail_input(p->gif_ptr, avial_buf_ptr); |
181 } | 181 } |
182 void CCodec_GifModule::Input(void* pContext, | 182 void CCodec_GifModule::Input(void* pContext, |
183 const uint8_t* src_buf, | 183 const uint8_t* src_buf, |
184 FX_DWORD src_size) { | 184 uint32_t src_size) { |
185 FXGIF_Context* p = (FXGIF_Context*)pContext; | 185 FXGIF_Context* p = (FXGIF_Context*)pContext; |
186 gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size); | 186 gif_input_buffer(p->gif_ptr, (uint8_t*)src_buf, src_size); |
187 } | 187 } |
OLD | NEW |