| 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 |
| 11 void CGifLZWDecoder::Input(uint8_t* src_buf, uint32_t src_size) { | 11 void CGifLZWDecoder::Input(uint8_t* src_buf, uint32_t src_size) { |
| 12 next_in = src_buf; | 12 next_in = src_buf; |
| 13 avail_in = src_size; | 13 avail_in = src_size; |
| 14 } | 14 } |
| 15 |
| 15 uint32_t CGifLZWDecoder::GetAvailInput() { | 16 uint32_t CGifLZWDecoder::GetAvailInput() { |
| 16 return avail_in; | 17 return avail_in; |
| 17 } | 18 } |
| 19 |
| 20 CGifLZWDecoder::CGifLZWDecoder(FX_CHAR* error_ptr) |
| 21 : code_size(0), |
| 22 code_size_cur(0), |
| 23 code_clear(0), |
| 24 code_end(0), |
| 25 code_next(0), |
| 26 code_first(0), |
| 27 stack_size(0), |
| 28 code_old(0), |
| 29 next_in(nullptr), |
| 30 avail_in(0), |
| 31 bits_left(0), |
| 32 code_store(0), |
| 33 err_msg_ptr(error_ptr) {} |
| 34 |
| 35 CGifLZWDecoder::~CGifLZWDecoder() {} |
| 36 |
| 18 void CGifLZWDecoder::InitTable(uint8_t code_len) { | 37 void CGifLZWDecoder::InitTable(uint8_t code_len) { |
| 19 code_size = code_len; | 38 code_size = code_len; |
| 20 code_clear = 1 << code_size; | 39 code_clear = 1 << code_size; |
| 21 code_end = code_clear + 1; | 40 code_end = code_clear + 1; |
| 22 bits_left = 0; | 41 bits_left = 0; |
| 23 code_store = 0; | 42 code_store = 0; |
| 24 next_in = nullptr; | 43 next_in = nullptr; |
| 25 avail_in = 0; | 44 avail_in = 0; |
| 26 stack_size = 0; | 45 stack_size = 0; |
| 27 code_first = 0; | 46 code_first = 0; |
| (...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 gif_ptr->cur_offset = cur_offset; | 1231 gif_ptr->cur_offset = cur_offset; |
| 1213 res = FALSE; | 1232 res = FALSE; |
| 1214 } | 1233 } |
| 1215 dst_len = gif_ptr->cur_offset; | 1234 dst_len = gif_ptr->cur_offset; |
| 1216 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; | 1235 dst_buf[dst_len - 1] = GIF_SIG_TRAILER; |
| 1217 if (res) { | 1236 if (res) { |
| 1218 gif_ptr->frames++; | 1237 gif_ptr->frames++; |
| 1219 } | 1238 } |
| 1220 return res; | 1239 return res; |
| 1221 } | 1240 } |
| OLD | NEW |