Chromium Code Reviews| 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/lgif/fx_gif.h" | 7 #include "core/fxcodec/lgif/fx_gif.h" |
| 8 | 8 |
| 9 #include "core/fxcodec/lbmp/fx_bmp.h" | 9 #include "core/fxcodec/lbmp/fx_bmp.h" |
| 10 | 10 |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 963 } | 963 } |
| 964 if (ret == 3) { | 964 if (ret == 3) { |
| 965 if (((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace) { | 965 if (((GifLF*)&gif_image_ptr->image_info_ptr->local_flag)->interlace) { |
| 966 gif_ptr->gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num, | 966 gif_ptr->gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num, |
| 967 gif_image_ptr->image_row_buf); | 967 gif_image_ptr->image_row_buf); |
| 968 gif_image_ptr->image_row_num += | 968 gif_image_ptr->image_row_num += |
| 969 s_gif_interlace_step[gif_ptr->img_pass_num]; | 969 s_gif_interlace_step[gif_ptr->img_pass_num]; |
| 970 if (gif_image_ptr->image_row_num >= | 970 if (gif_image_ptr->image_row_num >= |
| 971 (int32_t)gif_image_ptr->image_info_ptr->height) { | 971 (int32_t)gif_image_ptr->image_info_ptr->height) { |
| 972 gif_ptr->img_pass_num++; | 972 gif_ptr->img_pass_num++; |
| 973 if (gif_ptr->img_pass_num == | |
| 974 sizeof(s_gif_interlace_step) / sizeof(int32_t)) { | |
|
Lei Zhang
2016/08/10 14:58:31
This can be: FX_ArraySize(s_gif_interlace_step)
| |
| 975 FX_Free(gif_image_ptr->image_row_buf); | |
|
Tom Sepez
2016/08/10 17:23:22
Nit: we do this same cleanup in at least 3 places
| |
| 976 gif_image_ptr->image_row_buf = nullptr; | |
| 977 gif_save_decoding_status(gif_ptr, GIF_D_STATUS_TAIL); | |
| 978 gif_error(gif_ptr, "Decode Image Data Error"); | |
| 979 return 0; | |
| 980 } | |
| 973 gif_image_ptr->image_row_num = | 981 gif_image_ptr->image_row_num = |
| 974 s_gif_interlace_step[gif_ptr->img_pass_num] / 2; | 982 s_gif_interlace_step[gif_ptr->img_pass_num] / 2; |
| 975 } | 983 } |
| 976 } else { | 984 } else { |
| 977 gif_ptr->gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num++, | 985 gif_ptr->gif_get_row_fn(gif_ptr, gif_image_ptr->image_row_num++, |
| 978 gif_image_ptr->image_row_buf); | 986 gif_image_ptr->image_row_buf); |
| 979 } | 987 } |
| 980 gif_ptr->img_row_offset = 0; | 988 gif_ptr->img_row_offset = 0; |
| 981 gif_ptr->img_row_avail_size = gif_img_row_bytes; | 989 gif_ptr->img_row_avail_size = gif_img_row_bytes; |
| 982 ret = img_decoder_ptr->Decode( | 990 ret = img_decoder_ptr->Decode( |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1231 gif_ptr->cur_offset = cur_offset; | 1239 gif_ptr->cur_offset = cur_offset; |
| 1232 res = FALSE; | 1240 res = FALSE; |
| 1233 } | 1241 } |
| 1234 dst_len = gif_ptr->cur_offset; | 1242 dst_len = gif_ptr->cur_offset; |
| 1235 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; | 1243 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; |
| 1236 if (res) { | 1244 if (res) { |
| 1237 gif_ptr->frames++; | 1245 gif_ptr->frames++; |
| 1238 } | 1246 } |
| 1239 return res; | 1247 return res; |
| 1240 } | 1248 } |
| OLD | NEW |