| 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 "fx_gif.h" | 7 #include "fx_gif.h" |
| 8 void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size) | 8 void CGifLZWDecoder::Input(FX_LPBYTE src_buf, FX_DWORD src_size) |
| 9 { | 9 { |
| 10 next_in = src_buf; | 10 next_in = src_buf; |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr) | 1140 FX_INT32 _gif_get_frame_num(gif_decompress_struct_p gif_ptr) |
| 1141 { | 1141 { |
| 1142 return gif_ptr->img_ptr_arr_ptr->GetSize(); | 1142 return gif_ptr->img_ptr_arr_ptr->GetSize(); |
| 1143 } | 1143 } |
| 1144 static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_
buf, FX_DWORD& dst_len ) | 1144 static FX_BOOL _gif_write_header( gif_compress_struct_p gif_ptr, FX_LPBYTE& dst_
buf, FX_DWORD& dst_len ) |
| 1145 { | 1145 { |
| 1146 if (gif_ptr->cur_offset) { | 1146 if (gif_ptr->cur_offset) { |
| 1147 return TRUE; | 1147 return TRUE; |
| 1148 } | 1148 } |
| 1149 dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF); | 1149 dst_len = sizeof(GifHeader) + sizeof(GifLSD) + sizeof(GifGF); |
| 1150 dst_buf = FX_AllocNL(FX_BYTE, dst_len); | 1150 dst_buf = FX_TryAlloc(FX_BYTE, dst_len); |
| 1151 if (dst_buf == NULL) { | 1151 if (dst_buf == NULL) { |
| 1152 return FALSE; | 1152 return FALSE; |
| 1153 } | 1153 } |
| 1154 FXSYS_memset32(dst_buf, 0, dst_len); | 1154 FXSYS_memset32(dst_buf, 0, dst_len); |
| 1155 FXSYS_memcpy32(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader)); | 1155 FXSYS_memcpy32(dst_buf, gif_ptr->header_ptr, sizeof(GifHeader)); |
| 1156 gif_ptr->cur_offset += sizeof(GifHeader); | 1156 gif_ptr->cur_offset += sizeof(GifHeader); |
| 1157 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width); | 1157 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->width); |
| 1158 gif_ptr->cur_offset += 2; | 1158 gif_ptr->cur_offset += 2; |
| 1159 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height); | 1159 _SetWord_LSBFirst(dst_buf + gif_ptr->cur_offset, gif_ptr->lsd_ptr->height); |
| 1160 gif_ptr->cur_offset += 2; | 1160 gif_ptr->cur_offset += 2; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 gif_ptr->cur_offset = cur_offset; | 1340 gif_ptr->cur_offset = cur_offset; |
| 1341 res = FALSE; | 1341 res = FALSE; |
| 1342 } | 1342 } |
| 1343 dst_len = gif_ptr->cur_offset; | 1343 dst_len = gif_ptr->cur_offset; |
| 1344 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; | 1344 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; |
| 1345 if (res) { | 1345 if (res) { |
| 1346 gif_ptr->frames++; | 1346 gif_ptr->frames++; |
| 1347 } | 1347 } |
| 1348 return res; | 1348 return res; |
| 1349 } | 1349 } |
| OLD | NEW |